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 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.18.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.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) = apply { this.voidedAt = voidedAt } - /** The unique identifier for credit notes. */ fun creditNoteNumber(creditNoteNumber: String) = creditNoteNumber(JsonField.of(creditNoteNumber)) @@ -272,25 +266,58 @@ private constructor( this.creditNoteNumber = creditNoteNumber } + /** A URL to a PDF of the credit note. */ + fun creditNotePdf(creditNotePdf: String) = creditNotePdf(JsonField.of(creditNotePdf)) + + /** A URL to a PDF of the credit note. */ + fun creditNotePdf(creditNotePdf: JsonField) = apply { + this.creditNotePdf = creditNotePdf + } + + fun customer(customer: Customer) = customer(JsonField.of(customer)) + + fun customer(customer: JsonField) = apply { this.customer = customer } + /** The id of the invoice resource that this credit note is applied to. */ fun invoiceId(invoiceId: String) = invoiceId(JsonField.of(invoiceId)) /** The id of the invoice resource that this credit note is applied to. */ fun invoiceId(invoiceId: JsonField) = apply { this.invoiceId = invoiceId } + /** All of the line items associated with this credit note. */ + fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) + + /** All of the line items associated with this credit note. */ + fun lineItems(lineItems: JsonField>) = apply { this.lineItems = lineItems } + + /** The maximum amount applied on the original invoice */ + fun maximumAmountAdjustment(maximumAmountAdjustment: MaximumAmountAdjustment) = + maximumAmountAdjustment(JsonField.of(maximumAmountAdjustment)) + + /** The maximum amount applied on the original invoice */ + fun maximumAmountAdjustment(maximumAmountAdjustment: JsonField) = + apply { + this.maximumAmountAdjustment = maximumAmountAdjustment + } + /** An optional memo supplied on the credit note. */ fun memo(memo: String) = memo(JsonField.of(memo)) /** An optional memo supplied on the credit note. */ fun memo(memo: JsonField) = apply { this.memo = memo } - fun reason(reason: Reason) = reason(JsonField.of(reason)) + /** Any credited amount from the applied minimum on the invoice. */ + fun minimumAmountRefunded(minimumAmountRefunded: String) = + minimumAmountRefunded(JsonField.of(minimumAmountRefunded)) - fun reason(reason: JsonField) = apply { this.reason = reason } + /** Any credited amount from the applied minimum on the invoice. */ + fun minimumAmountRefunded(minimumAmountRefunded: JsonField) = apply { + this.minimumAmountRefunded = minimumAmountRefunded + } - fun type(type: Type) = type(JsonField.of(type)) + fun reason(reason: Reason) = reason(JsonField.of(reason)) - fun type(type: JsonField) = apply { this.type = type } + fun reason(reason: JsonField) = apply { this.reason = reason } /** The total prior to any creditable invoice-level discounts or minimums. */ fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) @@ -304,26 +331,15 @@ private constructor( /** The total including creditable invoice-level discounts or minimums, and tax. */ fun total(total: JsonField) = apply { this.total = total } - fun customer(customer: Customer) = customer(JsonField.of(customer)) - - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** A URL to a PDF of the credit note. */ - fun creditNotePdf(creditNotePdf: String) = creditNotePdf(JsonField.of(creditNotePdf)) + fun type(type: Type) = type(JsonField.of(type)) - /** A URL to a PDF of the credit note. */ - fun creditNotePdf(creditNotePdf: JsonField) = apply { - this.creditNotePdf = creditNotePdf - } + fun type(type: JsonField) = apply { this.type = type } - /** Any credited amount from the applied minimum on the invoice. */ - fun minimumAmountRefunded(minimumAmountRefunded: String) = - minimumAmountRefunded(JsonField.of(minimumAmountRefunded)) + /** The time at which the credit note was voided in Orb, if applicable. */ + fun voidedAt(voidedAt: OffsetDateTime) = voidedAt(JsonField.of(voidedAt)) - /** Any credited amount from the applied minimum on the invoice. */ - fun minimumAmountRefunded(minimumAmountRefunded: JsonField) = apply { - this.minimumAmountRefunded = minimumAmountRefunded - } + /** The time at which the credit note was voided in Orb, if applicable. */ + fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt } /** Any discounts applied on the original invoice. */ fun discounts(discounts: List) = discounts(JsonField.of(discounts)) @@ -331,22 +347,6 @@ private constructor( /** Any discounts applied on the original invoice. */ fun discounts(discounts: JsonField>) = apply { this.discounts = discounts } - /** The maximum amount applied on the original invoice */ - fun maximumAmountAdjustment(maximumAmountAdjustment: MaximumAmountAdjustment) = - maximumAmountAdjustment(JsonField.of(maximumAmountAdjustment)) - - /** The maximum amount applied on the original invoice */ - fun maximumAmountAdjustment(maximumAmountAdjustment: JsonField) = - apply { - this.maximumAmountAdjustment = maximumAmountAdjustment - } - - /** All of the line items associated with this credit note. */ - fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) - - /** All of the line items associated with this credit note. */ - fun lineItems(lineItems: JsonField>) = apply { this.lineItems = lineItems } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -370,20 +370,20 @@ private constructor( CreditNote( id, createdAt, - voidedAt, creditNoteNumber, + creditNotePdf, + customer, invoiceId, + lineItems.map { it.toImmutable() }, + maximumAmountAdjustment, memo, + minimumAmountRefunded, reason, - type, subtotal, total, - customer, - creditNotePdf, - minimumAmountRefunded, + type, + voidedAt, discounts.map { it.toImmutable() }, - maximumAmountAdjustment, - lineItems.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -506,24 +506,24 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("subtotal") - @ExcludeMissing - private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("discounts") + @JsonProperty("subtotal") @ExcludeMissing - private val discounts: JsonField> = JsonMissing.of(), + private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("tax_amounts") @ExcludeMissing private val taxAmounts: JsonField> = JsonMissing.of(), + @JsonProperty("discounts") + @ExcludeMissing + private val discounts: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -531,46 +531,46 @@ private constructor( /** The Orb id of this resource. */ fun id(): String = id.getRequired("id") + /** The amount of the line item, including any line item minimums and discounts. */ + fun amount(): String = amount.getRequired("amount") + /** The name of the corresponding invoice line item. */ fun name(): String = name.getRequired("name") + /** An optional quantity credited. */ + fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) + /** The amount of the line item, excluding any line item minimums and discounts. */ fun subtotal(): String = subtotal.getRequired("subtotal") - /** The amount of the line item, including any line item minimums and discounts. */ - fun amount(): String = amount.getRequired("amount") - - /** An optional quantity credited. */ - fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) + /** Any tax amounts applied onto the line item. */ + fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") /** Any line item discounts from the invoice's line item. */ fun discounts(): Optional> = Optional.ofNullable(discounts.getNullable("discounts")) - /** Any tax amounts applied onto the line item. */ - fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") - /** The Orb id of this resource. */ @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The name of the corresponding invoice line item. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** The amount of the line item, excluding any line item minimums and discounts. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal - /** The amount of the line item, including any line item minimums and discounts. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** The name of the corresponding invoice line item. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + /** An optional quantity credited. */ @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - /** Any line item discounts from the invoice's line item. */ - @JsonProperty("discounts") @ExcludeMissing fun _discounts() = discounts + /** The amount of the line item, excluding any line item minimums and discounts. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal /** Any tax amounts applied onto the line item. */ @JsonProperty("tax_amounts") @ExcludeMissing fun _taxAmounts() = taxAmounts + /** Any line item discounts from the invoice's line item. */ + @JsonProperty("discounts") @ExcludeMissing fun _discounts() = discounts + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -580,12 +580,12 @@ private constructor( fun validate(): LineItem = apply { if (!validated) { id() - name() - subtotal() amount() + name() quantity() - discounts().map { it.forEach { it.validate() } } + subtotal() taxAmounts().forEach { it.validate() } + discounts().map { it.forEach { it.validate() } } validated = true } } @@ -600,23 +600,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var subtotal: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var discounts: JsonField> = JsonMissing.of() + private var subtotal: JsonField = JsonMissing.of() private var taxAmounts: JsonField> = JsonMissing.of() + private var discounts: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(lineItem: LineItem) = apply { id = lineItem.id - name = lineItem.name - subtotal = lineItem.subtotal amount = lineItem.amount + name = lineItem.name quantity = lineItem.quantity - discounts = lineItem.discounts + subtotal = lineItem.subtotal taxAmounts = lineItem.taxAmounts + discounts = lineItem.discounts additionalProperties = lineItem.additionalProperties.toMutableMap() } @@ -626,23 +626,17 @@ private constructor( /** The Orb id of this resource. */ fun id(id: JsonField) = apply { this.id = id } - /** The name of the corresponding invoice line item. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the corresponding invoice line item. */ - fun name(name: JsonField) = apply { this.name = name } - - /** The amount of the line item, excluding any line item minimums and discounts. */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** The amount of the line item, excluding any line item minimums and discounts. */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - /** The amount of the line item, including any line item minimums and discounts. */ fun amount(amount: String) = amount(JsonField.of(amount)) - /** The amount of the line item, including any line item minimums and discounts. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** The amount of the line item, including any line item minimums and discounts. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** The name of the corresponding invoice line item. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the corresponding invoice line item. */ + fun name(name: JsonField) = apply { this.name = name } /** An optional quantity credited. */ fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) @@ -650,13 +644,11 @@ private constructor( /** An optional quantity credited. */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - /** Any line item discounts from the invoice's line item. */ - fun discounts(discounts: List) = discounts(JsonField.of(discounts)) + /** The amount of the line item, excluding any line item minimums and discounts. */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - /** Any line item discounts from the invoice's line item. */ - fun discounts(discounts: JsonField>) = apply { - this.discounts = discounts - } + /** The amount of the line item, excluding any line item minimums and discounts. */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } /** Any tax amounts applied onto the line item. */ fun taxAmounts(taxAmounts: List) = taxAmounts(JsonField.of(taxAmounts)) @@ -666,6 +658,14 @@ private constructor( this.taxAmounts = taxAmounts } + /** Any line item discounts from the invoice's line item. */ + fun discounts(discounts: List) = discounts(JsonField.of(discounts)) + + /** Any line item discounts from the invoice's line item. */ + fun discounts(discounts: JsonField>) = apply { + this.discounts = discounts + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -688,12 +688,12 @@ private constructor( fun build(): LineItem = LineItem( id, - name, - subtotal, amount, + name, quantity, - discounts.map { it.toImmutable() }, + subtotal, taxAmounts.map { it.toImmutable() }, + discounts.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -702,19 +702,22 @@ private constructor( class TaxAmount @JsonCreator private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_description") @ExcludeMissing private val taxRateDescription: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_percentage") @ExcludeMissing private val taxRatePercentage: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The amount of additional tax incurred by this tax rate. */ + fun amount(): String = amount.getRequired("amount") + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(): String = taxRateDescription.getRequired("tax_rate_description") @@ -724,7 +727,7 @@ private constructor( Optional.ofNullable(taxRatePercentage.getNullable("tax_rate_percentage")) /** The amount of additional tax incurred by this tax rate. */ - fun amount(): String = amount.getRequired("amount") + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** The human-readable description of the applied tax rate. */ @JsonProperty("tax_rate_description") @@ -736,9 +739,6 @@ private constructor( @ExcludeMissing fun _taxRatePercentage() = taxRatePercentage - /** The amount of additional tax incurred by this tax rate. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -747,9 +747,9 @@ private constructor( fun validate(): TaxAmount = apply { if (!validated) { + amount() taxRateDescription() taxRatePercentage() - amount() validated = true } } @@ -763,19 +763,25 @@ private constructor( class Builder { + private var amount: JsonField = JsonMissing.of() private var taxRateDescription: JsonField = JsonMissing.of() private var taxRatePercentage: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(taxAmount: TaxAmount) = apply { + amount = taxAmount.amount taxRateDescription = taxAmount.taxRateDescription taxRatePercentage = taxAmount.taxRatePercentage - amount = taxAmount.amount additionalProperties = taxAmount.additionalProperties.toMutableMap() } + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(taxRateDescription: String) = taxRateDescription(JsonField.of(taxRateDescription)) @@ -794,12 +800,6 @@ private constructor( this.taxRatePercentage = taxRatePercentage } - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -824,9 +824,9 @@ private constructor( fun build(): TaxAmount = TaxAmount( + amount, taxRateDescription, taxRatePercentage, - amount, additionalProperties.toImmutable(), ) } @@ -836,17 +836,17 @@ private constructor( return true } - return /* spotless:off */ other is TaxAmount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TaxAmount && amount == other.amount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(taxRateDescription, taxRatePercentage, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, taxRateDescription, taxRatePercentage, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TaxAmount{taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, amount=$amount, additionalProperties=$additionalProperties}" + "TaxAmount{amount=$amount, taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -856,6 +856,12 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount_applied") + @ExcludeMissing + private val amountApplied: 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(), @@ -865,21 +871,20 @@ private constructor( @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("amount_applied") - @ExcludeMissing - private val amountApplied: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun amountApplied(): String = amountApplied.getRequired("amount_applied") + + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + fun discountType(): DiscountType = discountType.getRequired("discount_type") fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") @@ -887,15 +892,16 @@ private constructor( fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount.getNullable("amount_discount")) - fun amountApplied(): String = amountApplied.getRequired("amount_applied") - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("amount_applied") @ExcludeMissing fun _amountApplied() = amountApplied + + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType @JsonProperty("percentage_discount") @@ -904,14 +910,8 @@ private constructor( @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount - @JsonProperty("amount_applied") @ExcludeMissing fun _amountApplied() = amountApplied - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -921,12 +921,12 @@ private constructor( fun validate(): Discount = apply { if (!validated) { id() + amountApplied() + appliesToPriceIds() discountType() percentageDiscount() amountDiscount() - amountApplied() reason() - appliesToPriceIds() validated = true } } @@ -941,23 +941,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var amountApplied: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var amountApplied: JsonField = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(discount: Discount) = apply { id = discount.id + amountApplied = discount.amountApplied + appliesToPriceIds = discount.appliesToPriceIds discountType = discount.discountType percentageDiscount = discount.percentageDiscount amountDiscount = discount.amountDiscount - amountApplied = discount.amountApplied reason = discount.reason - appliesToPriceIds = discount.appliesToPriceIds additionalProperties = discount.additionalProperties.toMutableMap() } @@ -965,6 +965,20 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun amountApplied(amountApplied: String) = + amountApplied(JsonField.of(amountApplied)) + + fun amountApplied(amountApplied: JsonField) = apply { + this.amountApplied = amountApplied + } + + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -986,24 +1000,10 @@ private constructor( this.amountDiscount = amountDiscount } - fun amountApplied(amountApplied: String) = - amountApplied(JsonField.of(amountApplied)) - - fun amountApplied(amountApplied: JsonField) = apply { - this.amountApplied = amountApplied - } - fun reason(reason: String) = reason(JsonField.of(reason)) fun reason(reason: JsonField) = apply { this.reason = reason } - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1029,12 +1029,12 @@ private constructor( fun build(): Discount = Discount( id, + amountApplied, + appliesToPriceIds.map { it.toImmutable() }, discountType, percentageDiscount, amountDiscount, - amountApplied, reason, - appliesToPriceIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -1101,17 +1101,17 @@ private constructor( return true } - return /* spotless:off */ other is Discount && id == other.id && discountType == other.discountType && percentageDiscount == other.percentageDiscount && amountDiscount == other.amountDiscount && amountApplied == other.amountApplied && reason == other.reason && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Discount && id == other.id && amountApplied == other.amountApplied && appliesToPriceIds == other.appliesToPriceIds && discountType == other.discountType && percentageDiscount == other.percentageDiscount && amountDiscount == other.amountDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, discountType, percentageDiscount, amountDiscount, amountApplied, reason, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amountApplied, appliesToPriceIds, discountType, percentageDiscount, amountDiscount, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Discount{id=$id, discountType=$discountType, percentageDiscount=$percentageDiscount, amountDiscount=$amountDiscount, amountApplied=$amountApplied, reason=$reason, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Discount{id=$id, amountApplied=$amountApplied, appliesToPriceIds=$appliesToPriceIds, discountType=$discountType, percentageDiscount=$percentageDiscount, amountDiscount=$amountDiscount, reason=$reason, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1119,17 +1119,17 @@ private constructor( return true } - return /* spotless:off */ other is LineItem && id == other.id && name == other.name && subtotal == other.subtotal && amount == other.amount && quantity == other.quantity && discounts == other.discounts && taxAmounts == other.taxAmounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LineItem && id == other.id && amount == other.amount && name == other.name && quantity == other.quantity && subtotal == other.subtotal && taxAmounts == other.taxAmounts && discounts == other.discounts && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, subtotal, amount, quantity, discounts, taxAmounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, name, quantity, subtotal, taxAmounts, discounts, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LineItem{id=$id, name=$name, subtotal=$subtotal, amount=$amount, quantity=$quantity, discounts=$discounts, taxAmounts=$taxAmounts, additionalProperties=$additionalProperties}" + "LineItem{id=$id, amount=$amount, name=$name, quantity=$quantity, subtotal=$subtotal, taxAmounts=$taxAmounts, discounts=$discounts, additionalProperties=$additionalProperties}" } /** The maximum amount applied on the original invoice */ @@ -1137,35 +1137,37 @@ private constructor( class MaximumAmountAdjustment @JsonCreator private constructor( + @JsonProperty("amount_applied") + @ExcludeMissing + private val amountApplied: JsonField = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("amount_applied") + @JsonProperty("applies_to_prices") @ExcludeMissing - private val amountApplied: JsonField = JsonMissing.of(), + private val appliesToPrices: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_prices") - @ExcludeMissing - private val appliesToPrices: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun amountApplied(): String = amountApplied.getRequired("amount_applied") + fun discountType(): DiscountType = discountType.getRequired("discount_type") fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - fun amountApplied(): String = amountApplied.getRequired("amount_applied") + fun appliesToPrices(): Optional> = + Optional.ofNullable(appliesToPrices.getNullable("applies_to_prices")) fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun appliesToPrices(): Optional> = - Optional.ofNullable(appliesToPrices.getNullable("applies_to_prices")) + @JsonProperty("amount_applied") @ExcludeMissing fun _amountApplied() = amountApplied @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType @@ -1173,12 +1175,10 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount - @JsonProperty("amount_applied") @ExcludeMissing fun _amountApplied() = amountApplied + @JsonProperty("applies_to_prices") @ExcludeMissing fun _appliesToPrices() = appliesToPrices @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("applies_to_prices") @ExcludeMissing fun _appliesToPrices() = appliesToPrices - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1187,11 +1187,11 @@ private constructor( fun validate(): MaximumAmountAdjustment = apply { if (!validated) { + amountApplied() discountType() percentageDiscount() - amountApplied() - reason() appliesToPrices().map { it.forEach { it.validate() } } + reason() validated = true } } @@ -1205,23 +1205,29 @@ private constructor( class Builder { + private var amountApplied: JsonField = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() - private var amountApplied: JsonField = JsonMissing.of() - private var reason: JsonField = JsonMissing.of() private var appliesToPrices: JsonField> = JsonMissing.of() + private var reason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAmountAdjustment: MaximumAmountAdjustment) = apply { + amountApplied = maximumAmountAdjustment.amountApplied discountType = maximumAmountAdjustment.discountType percentageDiscount = maximumAmountAdjustment.percentageDiscount - amountApplied = maximumAmountAdjustment.amountApplied - reason = maximumAmountAdjustment.reason appliesToPrices = maximumAmountAdjustment.appliesToPrices + reason = maximumAmountAdjustment.reason additionalProperties = maximumAmountAdjustment.additionalProperties.toMutableMap() } + fun amountApplied(amountApplied: String) = amountApplied(JsonField.of(amountApplied)) + + fun amountApplied(amountApplied: JsonField) = apply { + this.amountApplied = amountApplied + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) fun discountType(discountType: JsonField) = apply { @@ -1235,16 +1241,6 @@ private constructor( this.percentageDiscount = percentageDiscount } - fun amountApplied(amountApplied: String) = amountApplied(JsonField.of(amountApplied)) - - fun amountApplied(amountApplied: JsonField) = apply { - this.amountApplied = amountApplied - } - - fun reason(reason: String) = reason(JsonField.of(reason)) - - fun reason(reason: JsonField) = apply { this.reason = reason } - fun appliesToPrices(appliesToPrices: List) = appliesToPrices(JsonField.of(appliesToPrices)) @@ -1252,6 +1248,10 @@ private constructor( this.appliesToPrices = appliesToPrices } + fun reason(reason: String) = reason(JsonField.of(reason)) + + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1273,11 +1273,11 @@ private constructor( fun build(): MaximumAmountAdjustment = MaximumAmountAdjustment( + amountApplied, discountType, percentageDiscount, - amountApplied, - reason, appliesToPrices.map { it.toImmutable() }, + reason, additionalProperties.toImmutable(), ) } @@ -1450,17 +1450,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAmountAdjustment && discountType == other.discountType && percentageDiscount == other.percentageDiscount && amountApplied == other.amountApplied && reason == other.reason && appliesToPrices == other.appliesToPrices && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAmountAdjustment && amountApplied == other.amountApplied && discountType == other.discountType && percentageDiscount == other.percentageDiscount && appliesToPrices == other.appliesToPrices && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, amountApplied, reason, appliesToPrices, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountApplied, discountType, percentageDiscount, appliesToPrices, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAmountAdjustment{discountType=$discountType, percentageDiscount=$percentageDiscount, amountApplied=$amountApplied, reason=$reason, appliesToPrices=$appliesToPrices, additionalProperties=$additionalProperties}" + "MaximumAmountAdjustment{amountApplied=$amountApplied, discountType=$discountType, percentageDiscount=$percentageDiscount, appliesToPrices=$appliesToPrices, reason=$reason, additionalProperties=$additionalProperties}" } class Reason @@ -1593,35 +1593,37 @@ private constructor( class Discount @JsonCreator private constructor( + @JsonProperty("amount_applied") + @ExcludeMissing + private val amountApplied: JsonField = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("amount_applied") + @JsonProperty("applies_to_prices") @ExcludeMissing - private val amountApplied: JsonField = JsonMissing.of(), + private val appliesToPrices: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_prices") - @ExcludeMissing - private val appliesToPrices: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun amountApplied(): String = amountApplied.getRequired("amount_applied") + fun discountType(): DiscountType = discountType.getRequired("discount_type") fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - fun amountApplied(): String = amountApplied.getRequired("amount_applied") + fun appliesToPrices(): Optional> = + Optional.ofNullable(appliesToPrices.getNullable("applies_to_prices")) fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun appliesToPrices(): Optional> = - Optional.ofNullable(appliesToPrices.getNullable("applies_to_prices")) + @JsonProperty("amount_applied") @ExcludeMissing fun _amountApplied() = amountApplied @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType @@ -1629,12 +1631,10 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount - @JsonProperty("amount_applied") @ExcludeMissing fun _amountApplied() = amountApplied + @JsonProperty("applies_to_prices") @ExcludeMissing fun _appliesToPrices() = appliesToPrices @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("applies_to_prices") @ExcludeMissing fun _appliesToPrices() = appliesToPrices - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1643,11 +1643,11 @@ private constructor( fun validate(): Discount = apply { if (!validated) { + amountApplied() discountType() percentageDiscount() - amountApplied() - reason() appliesToPrices().map { it.forEach { it.validate() } } + reason() validated = true } } @@ -1661,23 +1661,29 @@ private constructor( class Builder { + private var amountApplied: JsonField = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() - private var amountApplied: JsonField = JsonMissing.of() - private var reason: JsonField = JsonMissing.of() private var appliesToPrices: JsonField> = JsonMissing.of() + private var reason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(discount: Discount) = apply { + amountApplied = discount.amountApplied discountType = discount.discountType percentageDiscount = discount.percentageDiscount - amountApplied = discount.amountApplied - reason = discount.reason appliesToPrices = discount.appliesToPrices + reason = discount.reason additionalProperties = discount.additionalProperties.toMutableMap() } + fun amountApplied(amountApplied: String) = amountApplied(JsonField.of(amountApplied)) + + fun amountApplied(amountApplied: JsonField) = apply { + this.amountApplied = amountApplied + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) fun discountType(discountType: JsonField) = apply { @@ -1691,16 +1697,6 @@ private constructor( this.percentageDiscount = percentageDiscount } - fun amountApplied(amountApplied: String) = amountApplied(JsonField.of(amountApplied)) - - fun amountApplied(amountApplied: JsonField) = apply { - this.amountApplied = amountApplied - } - - fun reason(reason: String) = reason(JsonField.of(reason)) - - fun reason(reason: JsonField) = apply { this.reason = reason } - fun appliesToPrices(appliesToPrices: List) = appliesToPrices(JsonField.of(appliesToPrices)) @@ -1708,6 +1704,10 @@ private constructor( this.appliesToPrices = appliesToPrices } + fun reason(reason: String) = reason(JsonField.of(reason)) + + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1729,11 +1729,11 @@ private constructor( fun build(): Discount = Discount( + amountApplied, discountType, percentageDiscount, - amountApplied, - reason, appliesToPrices.map { it.toImmutable() }, + reason, additionalProperties.toImmutable(), ) } @@ -1906,17 +1906,17 @@ private constructor( return true } - return /* spotless:off */ other is Discount && discountType == other.discountType && percentageDiscount == other.percentageDiscount && amountApplied == other.amountApplied && reason == other.reason && appliesToPrices == other.appliesToPrices && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Discount && amountApplied == other.amountApplied && discountType == other.discountType && percentageDiscount == other.percentageDiscount && appliesToPrices == other.appliesToPrices && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, amountApplied, reason, appliesToPrices, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountApplied, discountType, percentageDiscount, appliesToPrices, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Discount{discountType=$discountType, percentageDiscount=$percentageDiscount, amountApplied=$amountApplied, reason=$reason, appliesToPrices=$appliesToPrices, additionalProperties=$additionalProperties}" + "Discount{amountApplied=$amountApplied, discountType=$discountType, percentageDiscount=$percentageDiscount, appliesToPrices=$appliesToPrices, reason=$reason, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1924,15 +1924,15 @@ private constructor( return true } - return /* spotless:off */ other is CreditNote && id == other.id && createdAt == other.createdAt && voidedAt == other.voidedAt && creditNoteNumber == other.creditNoteNumber && invoiceId == other.invoiceId && memo == other.memo && reason == other.reason && type == other.type && subtotal == other.subtotal && total == other.total && customer == other.customer && creditNotePdf == other.creditNotePdf && minimumAmountRefunded == other.minimumAmountRefunded && discounts == other.discounts && maximumAmountAdjustment == other.maximumAmountAdjustment && lineItems == other.lineItems && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditNote && id == other.id && createdAt == other.createdAt && creditNoteNumber == other.creditNoteNumber && creditNotePdf == other.creditNotePdf && customer == other.customer && invoiceId == other.invoiceId && lineItems == other.lineItems && maximumAmountAdjustment == other.maximumAmountAdjustment && memo == other.memo && minimumAmountRefunded == other.minimumAmountRefunded && reason == other.reason && subtotal == other.subtotal && total == other.total && type == other.type && voidedAt == other.voidedAt && discounts == other.discounts && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, createdAt, voidedAt, creditNoteNumber, invoiceId, memo, reason, type, subtotal, total, customer, creditNotePdf, minimumAmountRefunded, discounts, maximumAmountAdjustment, lineItems, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, createdAt, creditNoteNumber, creditNotePdf, customer, invoiceId, lineItems, maximumAmountAdjustment, memo, minimumAmountRefunded, reason, subtotal, total, type, voidedAt, discounts, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditNote{id=$id, createdAt=$createdAt, voidedAt=$voidedAt, creditNoteNumber=$creditNoteNumber, invoiceId=$invoiceId, memo=$memo, reason=$reason, type=$type, subtotal=$subtotal, total=$total, customer=$customer, creditNotePdf=$creditNotePdf, minimumAmountRefunded=$minimumAmountRefunded, discounts=$discounts, maximumAmountAdjustment=$maximumAmountAdjustment, lineItems=$lineItems, additionalProperties=$additionalProperties}" + "CreditNote{id=$id, createdAt=$createdAt, creditNoteNumber=$creditNoteNumber, creditNotePdf=$creditNotePdf, customer=$customer, invoiceId=$invoiceId, lineItems=$lineItems, maximumAmountAdjustment=$maximumAmountAdjustment, memo=$memo, minimumAmountRefunded=$minimumAmountRefunded, reason=$reason, subtotal=$subtotal, total=$total, type=$type, voidedAt=$voidedAt, discounts=$discounts, additionalProperties=$additionalProperties}" } 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 c7f345c0..3d26c038 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 @@ -100,10 +100,16 @@ constructor( } /** An optional memo to attach to the credit note. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String?) = apply { this.memo = memo } + + /** An optional memo to attach to the credit note. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) + + /** An optional reason for the credit note. */ + fun reason(reason: Reason?) = apply { this.reason = reason } /** An optional reason for the credit note. */ - fun reason(reason: Reason) = apply { this.reason = reason } + fun reason(reason: Optional) = reason(reason.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -178,10 +184,16 @@ constructor( fun addLineItem(lineItem: LineItem) = apply { body.addLineItem(lineItem) } /** An optional memo to attach to the credit note. */ - fun memo(memo: String) = apply { body.memo(memo) } + 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)) + + /** An optional reason for the credit note. */ + fun reason(reason: Reason?) = apply { body.reason(reason) } /** An optional reason for the credit note. */ - fun reason(reason: Reason) = apply { body.reason(reason) } + fun reason(reason: Optional) = reason(reason.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -312,18 +324,18 @@ constructor( class LineItem @JsonCreator private constructor( - @JsonProperty("invoice_line_item_id") private val invoiceLineItemId: String, @JsonProperty("amount") private val amount: String, + @JsonProperty("invoice_line_item_id") private val invoiceLineItemId: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The ID of the line item to credit. */ - @JsonProperty("invoice_line_item_id") fun invoiceLineItemId(): String = invoiceLineItemId - /** The total amount in the invoice's currency to credit this line item. */ @JsonProperty("amount") fun amount(): String = amount + /** The ID of the line item to credit. */ + @JsonProperty("invoice_line_item_id") fun invoiceLineItemId(): String = invoiceLineItemId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -337,25 +349,25 @@ constructor( class Builder { - private var invoiceLineItemId: String? = null private var amount: String? = null + private var invoiceLineItemId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(lineItem: LineItem) = apply { - invoiceLineItemId = lineItem.invoiceLineItemId amount = lineItem.amount + invoiceLineItemId = lineItem.invoiceLineItemId additionalProperties = lineItem.additionalProperties.toMutableMap() } + /** The total amount in the invoice's currency to credit this line item. */ + fun amount(amount: String) = apply { this.amount = amount } + /** The ID of the line item to credit. */ fun invoiceLineItemId(invoiceLineItemId: String) = apply { this.invoiceLineItemId = invoiceLineItemId } - /** The total amount in the invoice's currency to credit this line item. */ - fun amount(amount: String) = apply { this.amount = amount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -377,10 +389,10 @@ constructor( fun build(): LineItem = LineItem( + checkNotNull(amount) { "`amount` is required but was not set" }, checkNotNull(invoiceLineItemId) { "`invoiceLineItemId` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -390,17 +402,17 @@ constructor( return true } - return /* spotless:off */ other is LineItem && invoiceLineItemId == other.invoiceLineItemId && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LineItem && amount == other.amount && invoiceLineItemId == other.invoiceLineItemId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(invoiceLineItemId, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, invoiceLineItemId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LineItem{invoiceLineItemId=$invoiceLineItemId, amount=$amount, additionalProperties=$additionalProperties}" + "LineItem{amount=$amount, invoiceLineItemId=$invoiceLineItemId, additionalProperties=$additionalProperties}" } class Reason 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 ca8ec60c..4724e9eb 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 @@ -67,10 +67,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/Customer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt index d4ec15b9..bc43cd06 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 @@ -41,55 +41,55 @@ import java.util.Optional class Customer @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("external_customer_id") - @ExcludeMissing - private val externalCustomerId: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), - @JsonProperty("email") @ExcludeMissing private val email: JsonField = JsonMissing.of(), - @JsonProperty("timezone") - @ExcludeMissing - private val timezone: JsonField = JsonMissing.of(), - @JsonProperty("payment_provider_id") - @ExcludeMissing - private val paymentProviderId: JsonField = JsonMissing.of(), - @JsonProperty("payment_provider") + @JsonProperty("additional_emails") @ExcludeMissing - private val paymentProvider: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + private val additionalEmails: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("shipping_address") + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("balance") @ExcludeMissing - private val shippingAddress: JsonField = JsonMissing.of(), + private val balance: JsonField = JsonMissing.of(), @JsonProperty("billing_address") @ExcludeMissing private val billingAddress: JsonField = JsonMissing.of(), - @JsonProperty("balance") + @JsonProperty("created_at") @ExcludeMissing - private val balance: JsonField = JsonMissing.of(), + private val createdAt: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("tax_id") @ExcludeMissing private val taxId: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") + @JsonProperty("email") @ExcludeMissing private val email: JsonField = JsonMissing.of(), + @JsonProperty("email_delivery") @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), + private val emailDelivery: JsonField = JsonMissing.of(), @JsonProperty("exempt_from_automated_tax") @ExcludeMissing private val exemptFromAutomatedTax: JsonField = JsonMissing.of(), - @JsonProperty("email_delivery") + @JsonProperty("external_customer_id") @ExcludeMissing - private val emailDelivery: JsonField = JsonMissing.of(), - @JsonProperty("additional_emails") + private val externalCustomerId: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val additionalEmails: JsonField> = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("payment_provider") + @ExcludeMissing + private val paymentProvider: JsonField = JsonMissing.of(), + @JsonProperty("payment_provider_id") + @ExcludeMissing + private val paymentProviderId: JsonField = JsonMissing.of(), @JsonProperty("portal_url") @ExcludeMissing private val portalUrl: JsonField = JsonMissing.of(), + @JsonProperty("shipping_address") + @ExcludeMissing + private val shippingAddress: JsonField = JsonMissing.of(), + @JsonProperty("tax_id") @ExcludeMissing private val taxId: JsonField = JsonMissing.of(), + @JsonProperty("timezone") + @ExcludeMissing + private val timezone: JsonField = JsonMissing.of(), @JsonProperty("accounting_sync_configuration") @ExcludeMissing private val accountingSyncConfiguration: JsonField = @@ -100,14 +100,32 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + fun additionalEmails(): List = additionalEmails.getRequired("additional_emails") + + fun autoCollection(): Boolean = autoCollection.getRequired("auto_collection") + + /** The customer's current balance in their currency. */ + fun balance(): String = balance.getRequired("balance") + + fun billingAddress(): Optional = + Optional.ofNullable(billingAddress.getNullable("billing_address")) + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** - * 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`. + * A valid customer email, to be used for notifications. When Orb triggers payment through a + * payment gateway, this email will be used for any automatically issued receipts. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun email(): String = email.getRequired("email") - fun id(): String = id.getRequired("id") + fun emailDelivery(): Boolean = emailDelivery.getRequired("email_delivery") + + fun exemptFromAutomatedTax(): Optional = + Optional.ofNullable(exemptFromAutomatedTax.getNullable("exempt_from_automated_tax")) /** * An optional user-defined ID for this customer resource, used throughout the system as an @@ -117,21 +135,22 @@ private constructor( fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId.getNullable("external_customer_id")) - /** The full name of the customer */ - fun name(): String = name.getRequired("name") - /** - * A valid customer email, to be used for notifications. When Orb triggers payment through a - * payment gateway, this email will be used for any automatically issued receipts. + * 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 email(): String = email.getRequired("email") + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The full name of the customer */ + fun name(): String = name.getRequired("name") /** - * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". This - * "defaults to your account's timezone if not set. This cannot be changed after customer - * creation. + * This is used for creating charges or invoices in an external system via Orb. When not in test + * mode, the connection must first be configured in the Orb webapp. */ - fun timezone(): String = timezone.getRequired("timezone") + fun paymentProvider(): Optional = + Optional.ofNullable(paymentProvider.getNullable("payment_provider")) /** * The ID of this customer in an external payments solution, such as Stripe. This is used for @@ -140,26 +159,11 @@ private constructor( fun paymentProviderId(): Optional = Optional.ofNullable(paymentProviderId.getNullable("payment_provider_id")) - /** - * This is used for creating charges or invoices in an external system via Orb. When not in test - * mode, the connection must first be configured in the Orb webapp. - */ - fun paymentProvider(): Optional = - Optional.ofNullable(paymentProvider.getNullable("payment_provider")) - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun portalUrl(): Optional = Optional.ofNullable(portalUrl.getNullable("portal_url")) fun shippingAddress(): Optional = Optional.ofNullable(shippingAddress.getNullable("shipping_address")) - fun billingAddress(): Optional = - Optional.ofNullable(billingAddress.getNullable("billing_address")) - - /** The customer's current balance in their currency. */ - fun balance(): String = balance.getRequired("balance") - - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to the * headers of invoices. @@ -268,16 +272,12 @@ private constructor( */ fun taxId(): Optional = Optional.ofNullable(taxId.getNullable("tax_id")) - fun autoCollection(): Boolean = autoCollection.getRequired("auto_collection") - - fun exemptFromAutomatedTax(): Optional = - Optional.ofNullable(exemptFromAutomatedTax.getNullable("exempt_from_automated_tax")) - - fun emailDelivery(): Boolean = emailDelivery.getRequired("email_delivery") - - fun additionalEmails(): List = additionalEmails.getRequired("additional_emails") - - fun portalUrl(): Optional = Optional.ofNullable(portalUrl.getNullable("portal_url")) + /** + * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". This + * "defaults to your account's timezone if not set. This cannot be changed after customer + * creation. + */ + fun timezone(): String = timezone.getRequired("timezone") fun accountingSyncConfiguration(): Optional = Optional.ofNullable( @@ -287,14 +287,32 @@ private constructor( fun reportingConfiguration(): Optional = Optional.ofNullable(reportingConfiguration.getNullable("reporting_configuration")) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("additional_emails") @ExcludeMissing fun _additionalEmails() = additionalEmails + + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + + /** The customer's current balance in their currency. */ + @JsonProperty("balance") @ExcludeMissing fun _balance() = balance + + @JsonProperty("billing_address") @ExcludeMissing fun _billingAddress() = billingAddress + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** - * 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`. + * A valid customer email, to be used for notifications. When Orb triggers payment through a + * payment gateway, this email will be used for any automatically issued receipts. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + @JsonProperty("email") @ExcludeMissing fun _email() = email - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("email_delivery") @ExcludeMissing fun _emailDelivery() = emailDelivery + + @JsonProperty("exempt_from_automated_tax") + @ExcludeMissing + fun _exemptFromAutomatedTax() = exemptFromAutomatedTax /** * An optional user-defined ID for this customer resource, used throughout the system as an @@ -305,21 +323,21 @@ private constructor( @ExcludeMissing fun _externalCustomerId() = externalCustomerId - /** The full name of the customer */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - /** - * A valid customer email, to be used for notifications. When Orb triggers payment through a - * payment gateway, this email will be used for any automatically issued receipts. + * 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("email") @ExcludeMissing fun _email() = email + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The full name of the customer */ + @JsonProperty("name") @ExcludeMissing fun _name() = name /** - * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". This - * "defaults to your account's timezone if not set. This cannot be changed after customer - * creation. + * This is used for creating charges or invoices in an external system via Orb. When not in test + * mode, the connection must first be configured in the Orb webapp. */ - @JsonProperty("timezone") @ExcludeMissing fun _timezone() = timezone + @JsonProperty("payment_provider") @ExcludeMissing fun _paymentProvider() = paymentProvider /** * The ID of this customer in an external payments solution, such as Stripe. This is used for @@ -329,23 +347,10 @@ private constructor( @ExcludeMissing fun _paymentProviderId() = paymentProviderId - /** - * This is used for creating charges or invoices in an external system via Orb. When not in test - * mode, the connection must first be configured in the Orb webapp. - */ - @JsonProperty("payment_provider") @ExcludeMissing fun _paymentProvider() = paymentProvider - - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("portal_url") @ExcludeMissing fun _portalUrl() = portalUrl @JsonProperty("shipping_address") @ExcludeMissing fun _shippingAddress() = shippingAddress - @JsonProperty("billing_address") @ExcludeMissing fun _billingAddress() = billingAddress - - /** The customer's current balance in their currency. */ - @JsonProperty("balance") @ExcludeMissing fun _balance() = balance - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to the * headers of invoices. @@ -454,17 +459,12 @@ private constructor( */ @JsonProperty("tax_id") @ExcludeMissing fun _taxId() = taxId - @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - - @JsonProperty("exempt_from_automated_tax") - @ExcludeMissing - fun _exemptFromAutomatedTax() = exemptFromAutomatedTax - - @JsonProperty("email_delivery") @ExcludeMissing fun _emailDelivery() = emailDelivery - - @JsonProperty("additional_emails") @ExcludeMissing fun _additionalEmails() = additionalEmails - - @JsonProperty("portal_url") @ExcludeMissing fun _portalUrl() = portalUrl + /** + * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". This + * "defaults to your account's timezone if not set. This cannot be changed after customer + * creation. + */ + @JsonProperty("timezone") @ExcludeMissing fun _timezone() = timezone @JsonProperty("accounting_sync_configuration") @ExcludeMissing @@ -482,25 +482,25 @@ private constructor( fun validate(): Customer = apply { if (!validated) { - metadata().validate() id() + additionalEmails() + autoCollection() + balance() + billingAddress().map { it.validate() } + createdAt() + currency() + email() + emailDelivery() + exemptFromAutomatedTax() externalCustomerId() + metadata().validate() name() - email() - timezone() - paymentProviderId() paymentProvider() - createdAt() + paymentProviderId() + portalUrl() shippingAddress().map { it.validate() } - billingAddress().map { it.validate() } - balance() - currency() taxId().map { it.validate() } - autoCollection() - exemptFromAutomatedTax() - emailDelivery() - additionalEmails() - portalUrl() + timezone() accountingSyncConfiguration().map { it.validate() } reportingConfiguration().map { it.validate() } validated = true @@ -516,25 +516,25 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() + private var additionalEmails: JsonField> = JsonMissing.of() + private var autoCollection: JsonField = JsonMissing.of() + private var balance: JsonField = JsonMissing.of() + private var billingAddress: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var email: JsonField = JsonMissing.of() + private var emailDelivery: JsonField = JsonMissing.of() + private var exemptFromAutomatedTax: JsonField = JsonMissing.of() private var externalCustomerId: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() - private var email: JsonField = JsonMissing.of() - private var timezone: JsonField = JsonMissing.of() - private var paymentProviderId: JsonField = JsonMissing.of() private var paymentProvider: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() + private var paymentProviderId: JsonField = JsonMissing.of() + private var portalUrl: JsonField = JsonMissing.of() private var shippingAddress: JsonField = JsonMissing.of() - private var billingAddress: JsonField = JsonMissing.of() - private var balance: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var taxId: JsonField = JsonMissing.of() - private var autoCollection: JsonField = JsonMissing.of() - private var exemptFromAutomatedTax: JsonField = JsonMissing.of() - private var emailDelivery: JsonField = JsonMissing.of() - private var additionalEmails: JsonField> = JsonMissing.of() - private var portalUrl: JsonField = JsonMissing.of() + private var timezone: JsonField = JsonMissing.of() private var accountingSyncConfiguration: JsonField = JsonMissing.of() private var reportingConfiguration: JsonField = JsonMissing.of() @@ -542,47 +542,92 @@ private constructor( @JvmSynthetic internal fun from(customer: Customer) = apply { - metadata = customer.metadata id = customer.id + additionalEmails = customer.additionalEmails + autoCollection = customer.autoCollection + balance = customer.balance + billingAddress = customer.billingAddress + createdAt = customer.createdAt + currency = customer.currency + email = customer.email + emailDelivery = customer.emailDelivery + exemptFromAutomatedTax = customer.exemptFromAutomatedTax externalCustomerId = customer.externalCustomerId + metadata = customer.metadata name = customer.name - email = customer.email - timezone = customer.timezone - paymentProviderId = customer.paymentProviderId paymentProvider = customer.paymentProvider - createdAt = customer.createdAt + paymentProviderId = customer.paymentProviderId + portalUrl = customer.portalUrl shippingAddress = customer.shippingAddress - billingAddress = customer.billingAddress - balance = customer.balance - currency = customer.currency taxId = customer.taxId - autoCollection = customer.autoCollection - exemptFromAutomatedTax = customer.exemptFromAutomatedTax - emailDelivery = customer.emailDelivery - additionalEmails = customer.additionalEmails - portalUrl = customer.portalUrl + timezone = customer.timezone accountingSyncConfiguration = customer.accountingSyncConfiguration reportingConfiguration = customer.reportingConfiguration additionalProperties = customer.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + fun additionalEmails(additionalEmails: List) = + additionalEmails(JsonField.of(additionalEmails)) + + fun additionalEmails(additionalEmails: JsonField>) = apply { + this.additionalEmails = additionalEmails + } + + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } + + /** The customer's current balance in their currency. */ + fun balance(balance: String) = balance(JsonField.of(balance)) + + /** The customer's current balance in their currency. */ + fun balance(balance: JsonField) = apply { this.balance = balance } + + fun billingAddress(billingAddress: BillingAddress) = + billingAddress(JsonField.of(billingAddress)) + + fun billingAddress(billingAddress: JsonField) = apply { + this.billingAddress = billingAddress + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + /** - * 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`. + * A valid customer email, to be used for notifications. When Orb triggers payment through a + * payment gateway, this email will be used for any automatically issued receipts. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun email(email: String) = email(JsonField.of(email)) /** - * 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`. + * A valid customer email, to be used for notifications. When Orb triggers payment through a + * payment gateway, this email will be used for any automatically issued receipts. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun email(email: JsonField) = apply { this.email = email } - fun id(id: String) = id(JsonField.of(id)) + fun emailDelivery(emailDelivery: Boolean) = emailDelivery(JsonField.of(emailDelivery)) - fun id(id: JsonField) = apply { this.id = id } + fun emailDelivery(emailDelivery: JsonField) = apply { + this.emailDelivery = emailDelivery + } + + fun exemptFromAutomatedTax(exemptFromAutomatedTax: Boolean) = + exemptFromAutomatedTax(JsonField.of(exemptFromAutomatedTax)) + + fun exemptFromAutomatedTax(exemptFromAutomatedTax: JsonField) = apply { + this.exemptFromAutomatedTax = exemptFromAutomatedTax + } /** * An optional user-defined ID for this customer resource, used throughout the system as an @@ -601,37 +646,40 @@ private constructor( this.externalCustomerId = externalCustomerId } - /** The full name of the customer */ - fun name(name: String) = name(JsonField.of(name)) - - /** The full name of the customer */ - fun name(name: JsonField) = apply { this.name = name } - /** - * A valid customer email, to be used for notifications. When Orb triggers payment through a - * payment gateway, this email will be used for any automatically issued receipts. + * 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 email(email: String) = email(JsonField.of(email)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * A valid customer email, to be used for notifications. When Orb triggers payment through a - * payment gateway, this email will be used for any automatically issued receipts. + * 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 email(email: JsonField) = apply { this.email = email } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The full name of the customer */ + fun name(name: String) = name(JsonField.of(name)) + + /** The full name of the customer */ + fun name(name: JsonField) = apply { this.name = name } /** - * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". - * This "defaults to your account's timezone if not set. This cannot be changed after - * customer creation. + * This is used for creating charges or invoices in an external system via Orb. When not in + * test mode, the connection must first be configured in the Orb webapp. */ - fun timezone(timezone: String) = timezone(JsonField.of(timezone)) + fun paymentProvider(paymentProvider: PaymentProvider) = + paymentProvider(JsonField.of(paymentProvider)) /** - * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". - * This "defaults to your account's timezone if not set. This cannot be changed after - * customer creation. + * This is used for creating charges or invoices in an external system via Orb. When not in + * test mode, the connection must first be configured in the Orb webapp. */ - fun timezone(timezone: JsonField) = apply { this.timezone = timezone } + fun paymentProvider(paymentProvider: JsonField) = apply { + this.paymentProvider = paymentProvider + } /** * The ID of this customer in an external payments solution, such as Stripe. This is used @@ -648,24 +696,9 @@ private constructor( this.paymentProviderId = paymentProviderId } - /** - * This is used for creating charges or invoices in an external system via Orb. When not in - * test mode, the connection must first be configured in the Orb webapp. - */ - fun paymentProvider(paymentProvider: PaymentProvider) = - paymentProvider(JsonField.of(paymentProvider)) - - /** - * This is used for creating charges or invoices in an external system via Orb. When not in - * test mode, the connection must first be configured in the Orb webapp. - */ - fun paymentProvider(paymentProvider: JsonField) = apply { - this.paymentProvider = paymentProvider - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun portalUrl(portalUrl: String) = portalUrl(JsonField.of(portalUrl)) - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + fun portalUrl(portalUrl: JsonField) = apply { this.portalUrl = portalUrl } fun shippingAddress(shippingAddress: ShippingAddress) = shippingAddress(JsonField.of(shippingAddress)) @@ -674,23 +707,6 @@ private constructor( this.shippingAddress = shippingAddress } - fun billingAddress(billingAddress: BillingAddress) = - billingAddress(JsonField.of(billingAddress)) - - fun billingAddress(billingAddress: JsonField) = apply { - this.billingAddress = billingAddress - } - - /** The customer's current balance in their currency. */ - fun balance(balance: String) = balance(JsonField.of(balance)) - - /** The customer's current balance in their currency. */ - fun balance(balance: JsonField) = apply { this.balance = balance } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to * the headers of invoices. @@ -907,35 +923,19 @@ private constructor( */ fun taxId(taxId: JsonField) = apply { this.taxId = taxId } - fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) - - fun autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection - } - - fun exemptFromAutomatedTax(exemptFromAutomatedTax: Boolean) = - exemptFromAutomatedTax(JsonField.of(exemptFromAutomatedTax)) - - fun exemptFromAutomatedTax(exemptFromAutomatedTax: JsonField) = apply { - this.exemptFromAutomatedTax = exemptFromAutomatedTax - } - - fun emailDelivery(emailDelivery: Boolean) = emailDelivery(JsonField.of(emailDelivery)) - - fun emailDelivery(emailDelivery: JsonField) = apply { - this.emailDelivery = emailDelivery - } - - fun additionalEmails(additionalEmails: List) = - additionalEmails(JsonField.of(additionalEmails)) - - fun additionalEmails(additionalEmails: JsonField>) = apply { - this.additionalEmails = additionalEmails - } - - fun portalUrl(portalUrl: String) = portalUrl(JsonField.of(portalUrl)) + /** + * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". + * This "defaults to your account's timezone if not set. This cannot be changed after + * customer creation. + */ + fun timezone(timezone: String) = timezone(JsonField.of(timezone)) - fun portalUrl(portalUrl: JsonField) = apply { this.portalUrl = portalUrl } + /** + * A timezone identifier from the IANA timezone database, such as "America/Los_Angeles". + * This "defaults to your account's timezone if not set. This cannot be changed after + * customer creation. + */ + fun timezone(timezone: JsonField) = apply { this.timezone = timezone } fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration) = accountingSyncConfiguration(JsonField.of(accountingSyncConfiguration)) @@ -973,25 +973,25 @@ private constructor( fun build(): Customer = Customer( - metadata, id, + additionalEmails.map { it.toImmutable() }, + autoCollection, + balance, + billingAddress, + createdAt, + currency, + email, + emailDelivery, + exemptFromAutomatedTax, externalCustomerId, + metadata, name, - email, - timezone, - paymentProviderId, paymentProvider, - createdAt, + paymentProviderId, + portalUrl, shippingAddress, - billingAddress, - balance, - currency, taxId, - autoCollection, - exemptFromAutomatedTax, - emailDelivery, - additionalEmails.map { it.toImmutable() }, - portalUrl, + timezone, accountingSyncConfiguration, reportingConfiguration, additionalProperties.toImmutable(), @@ -1002,52 +1002,52 @@ private constructor( class BillingAddress @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), @JsonProperty("postal_code") @ExcludeMissing private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("country") + @JsonProperty("state") @ExcludeMissing - private val country: JsonField = JsonMissing.of(), + private val state: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing @@ -1057,12 +1057,12 @@ private constructor( fun validate(): BillingAddress = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -1076,48 +1076,48 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(billingAddress: BillingAddress) = apply { + city = billingAddress.city + country = billingAddress.country line1 = billingAddress.line1 line2 = billingAddress.line2 - city = billingAddress.city - state = billingAddress.state postalCode = billingAddress.postalCode - country = billingAddress.country + state = billingAddress.state additionalProperties = billingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = line1(JsonField.of(line1)) + fun city(city: String) = city(JsonField.of(city)) - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: String) = line2(JsonField.of(line2)) + fun country(country: String) = country(JsonField.of(country)) - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: String) = city(JsonField.of(city)) + fun line1(line1: String) = line1(JsonField.of(line1)) - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: String) = state(JsonField.of(state)) + fun line2(line2: String) = line2(JsonField.of(line2)) - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: String) = country(JsonField.of(country)) + fun state(state: String) = state(JsonField.of(state)) - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1140,12 +1140,12 @@ private constructor( fun build(): BillingAddress = BillingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1155,17 +1155,17 @@ private constructor( return true } - return /* spotless:off */ other is BillingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BillingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BillingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "BillingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } /** @@ -1327,52 +1327,52 @@ private constructor( class ShippingAddress @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), @JsonProperty("postal_code") @ExcludeMissing private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("country") + @JsonProperty("state") @ExcludeMissing - private val country: JsonField = JsonMissing.of(), + private val state: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing @@ -1382,12 +1382,12 @@ private constructor( fun validate(): ShippingAddress = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -1401,48 +1401,48 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(shippingAddress: ShippingAddress) = apply { + city = shippingAddress.city + country = shippingAddress.country line1 = shippingAddress.line1 line2 = shippingAddress.line2 - city = shippingAddress.city - state = shippingAddress.state postalCode = shippingAddress.postalCode - country = shippingAddress.country + state = shippingAddress.state additionalProperties = shippingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = line1(JsonField.of(line1)) + fun city(city: String) = city(JsonField.of(city)) - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: String) = line2(JsonField.of(line2)) + fun country(country: String) = country(JsonField.of(country)) - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: String) = city(JsonField.of(city)) + fun line1(line1: String) = line1(JsonField.of(line1)) - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: String) = state(JsonField.of(state)) + fun line2(line2: String) = line2(JsonField.of(line2)) - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: String) = country(JsonField.of(country)) + fun state(state: String) = state(JsonField.of(state)) - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1465,12 +1465,12 @@ private constructor( fun build(): ShippingAddress = ShippingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1480,17 +1480,17 @@ private constructor( return true } - return /* spotless:off */ other is ShippingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ShippingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ShippingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } /** @@ -2709,27 +2709,27 @@ private constructor( class AccountingSyncConfiguration @JsonCreator private constructor( - @JsonProperty("excluded") - @ExcludeMissing - private val excluded: JsonField = JsonMissing.of(), @JsonProperty("accounting_providers") @ExcludeMissing private val accountingProviders: JsonField> = JsonMissing.of(), + @JsonProperty("excluded") + @ExcludeMissing + private val excluded: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun excluded(): Boolean = excluded.getRequired("excluded") - fun accountingProviders(): List = accountingProviders.getRequired("accounting_providers") - @JsonProperty("excluded") @ExcludeMissing fun _excluded() = excluded + fun excluded(): Boolean = excluded.getRequired("excluded") @JsonProperty("accounting_providers") @ExcludeMissing fun _accountingProviders() = accountingProviders + @JsonProperty("excluded") @ExcludeMissing fun _excluded() = excluded + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2738,8 +2738,8 @@ private constructor( fun validate(): AccountingSyncConfiguration = apply { if (!validated) { - excluded() accountingProviders().forEach { it.validate() } + excluded() validated = true } } @@ -2753,22 +2753,18 @@ private constructor( class Builder { - private var excluded: JsonField = JsonMissing.of() private var accountingProviders: JsonField> = JsonMissing.of() + private var excluded: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingSyncConfiguration: AccountingSyncConfiguration) = apply { - excluded = accountingSyncConfiguration.excluded accountingProviders = accountingSyncConfiguration.accountingProviders + excluded = accountingSyncConfiguration.excluded additionalProperties = accountingSyncConfiguration.additionalProperties.toMutableMap() } - fun excluded(excluded: Boolean) = excluded(JsonField.of(excluded)) - - fun excluded(excluded: JsonField) = apply { this.excluded = excluded } - fun accountingProviders(accountingProviders: List) = accountingProviders(JsonField.of(accountingProviders)) @@ -2777,6 +2773,10 @@ private constructor( this.accountingProviders = accountingProviders } + fun excluded(excluded: Boolean) = excluded(JsonField.of(excluded)) + + fun excluded(excluded: JsonField) = apply { this.excluded = excluded } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2798,8 +2798,8 @@ private constructor( fun build(): AccountingSyncConfiguration = AccountingSyncConfiguration( - excluded, accountingProviders.map { it.toImmutable() }, + excluded, additionalProperties.toImmutable(), ) } @@ -2808,27 +2808,27 @@ private constructor( class AccountingProvider @JsonCreator private constructor( - @JsonProperty("provider_type") - @ExcludeMissing - private val providerType: JsonField = JsonMissing.of(), @JsonProperty("external_provider_id") @ExcludeMissing private val externalProviderId: JsonField = JsonMissing.of(), + @JsonProperty("provider_type") + @ExcludeMissing + private val providerType: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun providerType(): ProviderType = providerType.getRequired("provider_type") - fun externalProviderId(): Optional = Optional.ofNullable(externalProviderId.getNullable("external_provider_id")) - @JsonProperty("provider_type") @ExcludeMissing fun _providerType() = providerType + fun providerType(): ProviderType = providerType.getRequired("provider_type") @JsonProperty("external_provider_id") @ExcludeMissing fun _externalProviderId() = externalProviderId + @JsonProperty("provider_type") @ExcludeMissing fun _providerType() = providerType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2837,8 +2837,8 @@ private constructor( fun validate(): AccountingProvider = apply { if (!validated) { - providerType() externalProviderId() + providerType() validated = true } } @@ -2852,24 +2852,17 @@ private constructor( class Builder { - private var providerType: JsonField = JsonMissing.of() private var externalProviderId: JsonField = JsonMissing.of() + private var providerType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingProvider: AccountingProvider) = apply { - providerType = accountingProvider.providerType externalProviderId = accountingProvider.externalProviderId + providerType = accountingProvider.providerType additionalProperties = accountingProvider.additionalProperties.toMutableMap() } - fun providerType(providerType: ProviderType) = - providerType(JsonField.of(providerType)) - - fun providerType(providerType: JsonField) = apply { - this.providerType = providerType - } - fun externalProviderId(externalProviderId: String) = externalProviderId(JsonField.of(externalProviderId)) @@ -2877,6 +2870,13 @@ private constructor( this.externalProviderId = externalProviderId } + fun providerType(providerType: ProviderType) = + providerType(JsonField.of(providerType)) + + fun providerType(providerType: JsonField) = apply { + this.providerType = providerType + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2901,8 +2901,8 @@ private constructor( fun build(): AccountingProvider = AccountingProvider( - providerType, externalProviderId, + providerType, additionalProperties.toImmutable(), ) } @@ -2969,17 +2969,17 @@ private constructor( return true } - return /* spotless:off */ other is AccountingProvider && providerType == other.providerType && externalProviderId == other.externalProviderId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingProvider && externalProviderId == other.externalProviderId && providerType == other.providerType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(providerType, externalProviderId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalProviderId, providerType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingProvider{providerType=$providerType, externalProviderId=$externalProviderId, additionalProperties=$additionalProperties}" + "AccountingProvider{externalProviderId=$externalProviderId, providerType=$providerType, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2987,17 +2987,17 @@ private constructor( return true } - return /* spotless:off */ other is AccountingSyncConfiguration && excluded == other.excluded && accountingProviders == other.accountingProviders && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingSyncConfiguration && accountingProviders == other.accountingProviders && excluded == other.excluded && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(excluded, accountingProviders, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountingProviders, excluded, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingSyncConfiguration{excluded=$excluded, accountingProviders=$accountingProviders, additionalProperties=$additionalProperties}" + "AccountingSyncConfiguration{accountingProviders=$accountingProviders, excluded=$excluded, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3096,15 +3096,15 @@ private constructor( return true } - return /* spotless:off */ other is Customer && metadata == other.metadata && id == other.id && externalCustomerId == other.externalCustomerId && name == other.name && email == other.email && timezone == other.timezone && paymentProviderId == other.paymentProviderId && paymentProvider == other.paymentProvider && createdAt == other.createdAt && shippingAddress == other.shippingAddress && billingAddress == other.billingAddress && balance == other.balance && currency == other.currency && taxId == other.taxId && autoCollection == other.autoCollection && exemptFromAutomatedTax == other.exemptFromAutomatedTax && emailDelivery == other.emailDelivery && additionalEmails == other.additionalEmails && portalUrl == other.portalUrl && accountingSyncConfiguration == other.accountingSyncConfiguration && reportingConfiguration == other.reportingConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Customer && id == other.id && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && balance == other.balance && billingAddress == other.billingAddress && createdAt == other.createdAt && currency == other.currency && email == other.email && emailDelivery == other.emailDelivery && exemptFromAutomatedTax == other.exemptFromAutomatedTax && externalCustomerId == other.externalCustomerId && metadata == other.metadata && name == other.name && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && portalUrl == other.portalUrl && shippingAddress == other.shippingAddress && taxId == other.taxId && timezone == other.timezone && accountingSyncConfiguration == other.accountingSyncConfiguration && reportingConfiguration == other.reportingConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, externalCustomerId, name, email, timezone, paymentProviderId, paymentProvider, createdAt, shippingAddress, billingAddress, balance, currency, taxId, autoCollection, exemptFromAutomatedTax, emailDelivery, additionalEmails, portalUrl, accountingSyncConfiguration, reportingConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, additionalEmails, autoCollection, balance, billingAddress, createdAt, currency, email, emailDelivery, exemptFromAutomatedTax, externalCustomerId, metadata, name, paymentProvider, paymentProviderId, portalUrl, shippingAddress, taxId, timezone, accountingSyncConfiguration, reportingConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Customer{metadata=$metadata, id=$id, externalCustomerId=$externalCustomerId, name=$name, email=$email, timezone=$timezone, paymentProviderId=$paymentProviderId, paymentProvider=$paymentProvider, createdAt=$createdAt, shippingAddress=$shippingAddress, billingAddress=$billingAddress, balance=$balance, currency=$currency, taxId=$taxId, autoCollection=$autoCollection, exemptFromAutomatedTax=$exemptFromAutomatedTax, emailDelivery=$emailDelivery, additionalEmails=$additionalEmails, portalUrl=$portalUrl, accountingSyncConfiguration=$accountingSyncConfiguration, reportingConfiguration=$reportingConfiguration, additionalProperties=$additionalProperties}" + "Customer{id=$id, additionalEmails=$additionalEmails, autoCollection=$autoCollection, balance=$balance, billingAddress=$billingAddress, createdAt=$createdAt, currency=$currency, email=$email, emailDelivery=$emailDelivery, exemptFromAutomatedTax=$exemptFromAutomatedTax, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, portalUrl=$portalUrl, shippingAddress=$shippingAddress, taxId=$taxId, timezone=$timezone, accountingSyncConfiguration=$accountingSyncConfiguration, reportingConfiguration=$reportingConfiguration, additionalProperties=$additionalProperties}" } 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 1d28ee0c..02e3c23c 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 @@ -108,7 +108,10 @@ constructor( fun type(type: Type) = apply { this.type = type } /** An optional description that can be specified around this entry. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } + + /** An optional description that can be specified around this entry. */ + fun description(description: Optional) = description(description.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -190,7 +193,10 @@ constructor( fun type(type: Type) = apply { body.type(type) } /** An optional description that can be specified around this entry. */ - fun description(description: String) = apply { body.description(description) } + 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 additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() 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 ccf83dca..0bf92cb5 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 @@ -24,97 +24,97 @@ class CustomerBalanceTransactionCreateResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") + @JsonProperty("action") @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), + private val action: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), - @JsonProperty("action") + @JsonProperty("created_at") @ExcludeMissing - private val action: JsonField = JsonMissing.of(), + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_note") + @ExcludeMissing + private val creditNote: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), + @JsonProperty("ending_balance") + @ExcludeMissing + private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("invoice") @ExcludeMissing private val invoice: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("credit_note") + @JsonProperty("starting_balance") @ExcludeMissing - private val creditNote: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** A unique id for this transaction. */ fun id(): String = id.getRequired("id") - /** The creation time of this transaction. */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(): String = startingBalance.getRequired("starting_balance") - - /** - * The new value of the customer's balance prior to the transaction, in the customer's currency. - */ - fun endingBalance(): String = endingBalance.getRequired("ending_balance") + fun action(): Action = action.getRequired("action") /** The value of the amount changed in the transaction. */ fun amount(): String = amount.getRequired("amount") - fun action(): Action = action.getRequired("action") + /** The creation time of this transaction. */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + fun creditNote(): Optional = + Optional.ofNullable(creditNote.getNullable("credit_note")) /** An optional description provided for manual customer balance adjustments. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * The new value of the customer's balance prior to the transaction, in the customer's currency. + */ + fun endingBalance(): String = endingBalance.getRequired("ending_balance") + fun invoice(): Optional = Optional.ofNullable(invoice.getNullable("invoice")) - fun type(): Type = type.getRequired("type") + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(): String = startingBalance.getRequired("starting_balance") - fun creditNote(): Optional = - Optional.ofNullable(creditNote.getNullable("credit_note")) + fun type(): Type = type.getRequired("type") /** A unique id for this transaction. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("action") @ExcludeMissing fun _action() = action + + /** The value of the amount changed in the transaction. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** The creation time of this transaction. */ @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + + /** An optional description provided for manual customer balance adjustments. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description /** * The new value of the customer's balance prior to the transaction, in the customer's currency. */ @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - /** The value of the amount changed in the transaction. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("action") @ExcludeMissing fun _action() = action - - /** An optional description provided for manual customer balance adjustments. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("invoice") @ExcludeMissing fun _invoice() = invoice - @JsonProperty("type") @ExcludeMissing fun _type() = type + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance - @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing @@ -125,15 +125,15 @@ private constructor( fun validate(): CustomerBalanceTransactionCreateResponse = apply { if (!validated) { id() - createdAt() - startingBalance() - endingBalance() - amount() action() + amount() + createdAt() + creditNote().map { it.validate() } description() + endingBalance() invoice().map { it.validate() } + startingBalance() type() - creditNote().map { it.validate() } validated = true } } @@ -148,15 +148,15 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var action: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var creditNote: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() private var invoice: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var creditNote: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -164,15 +164,15 @@ private constructor( customerBalanceTransactionCreateResponse: CustomerBalanceTransactionCreateResponse ) = apply { id = customerBalanceTransactionCreateResponse.id - createdAt = customerBalanceTransactionCreateResponse.createdAt - startingBalance = customerBalanceTransactionCreateResponse.startingBalance - endingBalance = customerBalanceTransactionCreateResponse.endingBalance - amount = customerBalanceTransactionCreateResponse.amount action = customerBalanceTransactionCreateResponse.action + amount = customerBalanceTransactionCreateResponse.amount + createdAt = customerBalanceTransactionCreateResponse.createdAt + creditNote = customerBalanceTransactionCreateResponse.creditNote description = customerBalanceTransactionCreateResponse.description + endingBalance = customerBalanceTransactionCreateResponse.endingBalance invoice = customerBalanceTransactionCreateResponse.invoice + startingBalance = customerBalanceTransactionCreateResponse.startingBalance type = customerBalanceTransactionCreateResponse.type - creditNote = customerBalanceTransactionCreateResponse.creditNote additionalProperties = customerBalanceTransactionCreateResponse.additionalProperties.toMutableMap() } @@ -183,26 +183,31 @@ private constructor( /** A unique id for this transaction. */ fun id(id: JsonField) = apply { this.id = id } + fun action(action: Action) = action(JsonField.of(action)) + + fun action(action: JsonField) = apply { this.action = action } + + /** The value of the amount changed in the transaction. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The value of the amount changed in the transaction. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The creation time of this transaction. */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** The creation time of this transaction. */ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(startingBalance: String) = - startingBalance(JsonField.of(startingBalance)) + fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance - } + fun creditNote(creditNote: JsonField) = apply { this.creditNote = creditNote } + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: String) = description(JsonField.of(description)) + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: JsonField) = apply { this.description = description } /** * The new value of the customer's balance prior to the transaction, in the customer's @@ -218,33 +223,28 @@ private constructor( this.endingBalance = endingBalance } - /** The value of the amount changed in the transaction. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The value of the amount changed in the transaction. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun action(action: Action) = action(JsonField.of(action)) - - fun action(action: JsonField) = apply { this.action = action } - - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: String) = description(JsonField.of(description)) - - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: JsonField) = apply { this.description = description } - fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice)) fun invoice(invoice: JsonField) = apply { this.invoice = invoice } - fun type(type: Type) = type(JsonField.of(type)) + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(startingBalance: String) = + startingBalance(JsonField.of(startingBalance)) - fun type(type: JsonField) = apply { this.type = type } + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } - fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) + fun type(type: Type) = type(JsonField.of(type)) - fun creditNote(creditNote: JsonField) = apply { this.creditNote = creditNote } + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -268,15 +268,15 @@ private constructor( fun build(): CustomerBalanceTransactionCreateResponse = CustomerBalanceTransactionCreateResponse( id, - createdAt, - startingBalance, - endingBalance, - amount, action, + amount, + createdAt, + creditNote, description, + endingBalance, invoice, + startingBalance, type, - creditNote, additionalProperties.toImmutable(), ) } @@ -618,15 +618,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerBalanceTransactionCreateResponse && id == other.id && createdAt == other.createdAt && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && action == other.action && description == other.description && invoice == other.invoice && type == other.type && creditNote == other.creditNote && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransactionCreateResponse && id == other.id && action == other.action && amount == other.amount && createdAt == other.createdAt && creditNote == other.creditNote && description == other.description && endingBalance == other.endingBalance && invoice == other.invoice && startingBalance == other.startingBalance && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, createdAt, startingBalance, endingBalance, amount, action, description, invoice, type, creditNote, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, action, amount, createdAt, creditNote, description, endingBalance, invoice, startingBalance, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerBalanceTransactionCreateResponse{id=$id, createdAt=$createdAt, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, action=$action, description=$description, invoice=$invoice, type=$type, creditNote=$creditNote, additionalProperties=$additionalProperties}" + "CustomerBalanceTransactionCreateResponse{id=$id, action=$action, amount=$amount, createdAt=$createdAt, creditNote=$creditNote, description=$description, endingBalance=$endingBalance, invoice=$invoice, startingBalance=$startingBalance, type=$type, additionalProperties=$additionalProperties}" } 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 360c0f7e..eb971499 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 @@ -130,27 +130,52 @@ 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) = apply { this.limit = limit } + fun limit(limit: Long) = limit(limit as Long?) - fun operationTimeGt(operationTimeGt: OffsetDateTime) = apply { + /** 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 operationTimeGt(operationTimeGt: OffsetDateTime?) = apply { this.operationTimeGt = operationTimeGt } - fun operationTimeGte(operationTimeGte: OffsetDateTime) = apply { + fun operationTimeGt(operationTimeGt: Optional) = + operationTimeGt(operationTimeGt.orElse(null)) + + fun operationTimeGte(operationTimeGte: OffsetDateTime?) = apply { this.operationTimeGte = operationTimeGte } - fun operationTimeLt(operationTimeLt: OffsetDateTime) = apply { + fun operationTimeGte(operationTimeGte: Optional) = + operationTimeGte(operationTimeGte.orElse(null)) + + fun operationTimeLt(operationTimeLt: OffsetDateTime?) = apply { this.operationTimeLt = operationTimeLt } - fun operationTimeLte(operationTimeLte: OffsetDateTime) = apply { + fun operationTimeLt(operationTimeLt: Optional) = + operationTimeLt(operationTimeLt.orElse(null)) + + fun operationTimeLte(operationTimeLte: OffsetDateTime?) = apply { this.operationTimeLte = operationTimeLte } + fun operationTimeLte(operationTimeLte: Optional) = + operationTimeLte(operationTimeLte.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) 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 d283801e..913835ca 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 @@ -24,97 +24,97 @@ class CustomerBalanceTransactionListResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") + @JsonProperty("action") @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), + private val action: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), - @JsonProperty("action") + @JsonProperty("created_at") @ExcludeMissing - private val action: JsonField = JsonMissing.of(), + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_note") + @ExcludeMissing + private val creditNote: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), + @JsonProperty("ending_balance") + @ExcludeMissing + private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("invoice") @ExcludeMissing private val invoice: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("credit_note") + @JsonProperty("starting_balance") @ExcludeMissing - private val creditNote: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** A unique id for this transaction. */ fun id(): String = id.getRequired("id") - /** The creation time of this transaction. */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(): String = startingBalance.getRequired("starting_balance") - - /** - * The new value of the customer's balance prior to the transaction, in the customer's currency. - */ - fun endingBalance(): String = endingBalance.getRequired("ending_balance") + fun action(): Action = action.getRequired("action") /** The value of the amount changed in the transaction. */ fun amount(): String = amount.getRequired("amount") - fun action(): Action = action.getRequired("action") + /** The creation time of this transaction. */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + fun creditNote(): Optional = + Optional.ofNullable(creditNote.getNullable("credit_note")) /** An optional description provided for manual customer balance adjustments. */ fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + /** + * The new value of the customer's balance prior to the transaction, in the customer's currency. + */ + fun endingBalance(): String = endingBalance.getRequired("ending_balance") + fun invoice(): Optional = Optional.ofNullable(invoice.getNullable("invoice")) - fun type(): Type = type.getRequired("type") + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(): String = startingBalance.getRequired("starting_balance") - fun creditNote(): Optional = - Optional.ofNullable(creditNote.getNullable("credit_note")) + fun type(): Type = type.getRequired("type") /** A unique id for this transaction. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("action") @ExcludeMissing fun _action() = action + + /** The value of the amount changed in the transaction. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** The creation time of this transaction. */ @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + + /** An optional description provided for manual customer balance adjustments. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description /** * The new value of the customer's balance prior to the transaction, in the customer's currency. */ @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - /** The value of the amount changed in the transaction. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("action") @ExcludeMissing fun _action() = action - - /** An optional description provided for manual customer balance adjustments. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("invoice") @ExcludeMissing fun _invoice() = invoice - @JsonProperty("type") @ExcludeMissing fun _type() = type + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance - @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing @@ -125,15 +125,15 @@ private constructor( fun validate(): CustomerBalanceTransactionListResponse = apply { if (!validated) { id() - createdAt() - startingBalance() - endingBalance() - amount() action() + amount() + createdAt() + creditNote().map { it.validate() } description() + endingBalance() invoice().map { it.validate() } + startingBalance() type() - creditNote().map { it.validate() } validated = true } } @@ -148,15 +148,15 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var action: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var creditNote: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() private var invoice: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var creditNote: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -164,15 +164,15 @@ private constructor( customerBalanceTransactionListResponse: CustomerBalanceTransactionListResponse ) = apply { id = customerBalanceTransactionListResponse.id - createdAt = customerBalanceTransactionListResponse.createdAt - startingBalance = customerBalanceTransactionListResponse.startingBalance - endingBalance = customerBalanceTransactionListResponse.endingBalance - amount = customerBalanceTransactionListResponse.amount action = customerBalanceTransactionListResponse.action + amount = customerBalanceTransactionListResponse.amount + createdAt = customerBalanceTransactionListResponse.createdAt + creditNote = customerBalanceTransactionListResponse.creditNote description = customerBalanceTransactionListResponse.description + endingBalance = customerBalanceTransactionListResponse.endingBalance invoice = customerBalanceTransactionListResponse.invoice + startingBalance = customerBalanceTransactionListResponse.startingBalance type = customerBalanceTransactionListResponse.type - creditNote = customerBalanceTransactionListResponse.creditNote additionalProperties = customerBalanceTransactionListResponse.additionalProperties.toMutableMap() } @@ -183,26 +183,31 @@ private constructor( /** A unique id for this transaction. */ fun id(id: JsonField) = apply { this.id = id } + fun action(action: Action) = action(JsonField.of(action)) + + fun action(action: JsonField) = apply { this.action = action } + + /** The value of the amount changed in the transaction. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The value of the amount changed in the transaction. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The creation time of this transaction. */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** The creation time of this transaction. */ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(startingBalance: String) = - startingBalance(JsonField.of(startingBalance)) + fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance - } + fun creditNote(creditNote: JsonField) = apply { this.creditNote = creditNote } + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: String) = description(JsonField.of(description)) + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: JsonField) = apply { this.description = description } /** * The new value of the customer's balance prior to the transaction, in the customer's @@ -218,33 +223,28 @@ private constructor( this.endingBalance = endingBalance } - /** The value of the amount changed in the transaction. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The value of the amount changed in the transaction. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun action(action: Action) = action(JsonField.of(action)) - - fun action(action: JsonField) = apply { this.action = action } - - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: String) = description(JsonField.of(description)) - - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: JsonField) = apply { this.description = description } - fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice)) fun invoice(invoice: JsonField) = apply { this.invoice = invoice } - fun type(type: Type) = type(JsonField.of(type)) + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(startingBalance: String) = + startingBalance(JsonField.of(startingBalance)) - fun type(type: JsonField) = apply { this.type = type } + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } - fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) + fun type(type: Type) = type(JsonField.of(type)) - fun creditNote(creditNote: JsonField) = apply { this.creditNote = creditNote } + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -268,15 +268,15 @@ private constructor( fun build(): CustomerBalanceTransactionListResponse = CustomerBalanceTransactionListResponse( id, - createdAt, - startingBalance, - endingBalance, - amount, action, + amount, + createdAt, + creditNote, description, + endingBalance, invoice, + startingBalance, type, - creditNote, additionalProperties.toImmutable(), ) } @@ -618,15 +618,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerBalanceTransactionListResponse && id == other.id && createdAt == other.createdAt && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && action == other.action && description == other.description && invoice == other.invoice && type == other.type && creditNote == other.creditNote && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransactionListResponse && id == other.id && action == other.action && amount == other.amount && createdAt == other.createdAt && creditNote == other.creditNote && description == other.description && endingBalance == other.endingBalance && invoice == other.invoice && startingBalance == other.startingBalance && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, createdAt, startingBalance, endingBalance, amount, action, description, invoice, type, creditNote, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, action, amount, createdAt, creditNote, description, endingBalance, invoice, startingBalance, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerBalanceTransactionListResponse{id=$id, createdAt=$createdAt, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, action=$action, description=$description, invoice=$invoice, type=$type, creditNote=$creditNote, additionalProperties=$additionalProperties}" + "CustomerBalanceTransactionListResponse{id=$id, action=$action, amount=$amount, createdAt=$createdAt, creditNote=$creditNote, description=$description, endingBalance=$endingBalance, invoice=$invoice, startingBalance=$startingBalance, type=$type, additionalProperties=$additionalProperties}" } 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 aee3b000..8e72a504 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 @@ -113,22 +113,40 @@ constructor( } /** The currency or custom pricing unit to use. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** The currency or custom pricing unit to use. */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** 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: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: Optional) = + timeframeEnd(timeframeEnd.orElse(null)) /** Costs returned are inclusive of `timeframe_start`. */ - fun timeframeStart(timeframeStart: OffsetDateTime) = apply { + fun timeframeStart(timeframeStart: OffsetDateTime?) = apply { this.timeframeStart = timeframeStart } + /** Costs returned are inclusive of `timeframe_start`. */ + fun timeframeStart(timeframeStart: Optional) = + timeframeStart(timeframeStart.orElse(null)) + + /** + * Controls whether Orb returns cumulative costs since the start of the billing period, or + * 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: ViewMode?) = apply { this.viewMode = viewMode } + /** * Controls whether Orb returns cumulative costs since the start of the billing period, or * 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: ViewMode) = apply { this.viewMode = viewMode } + fun viewMode(viewMode: Optional) = viewMode(viewMode.orElse(null)) 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 fa176933..ef215cf0 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 @@ -99,48 +99,48 @@ private constructor( class Data @JsonCreator private constructor( + @JsonProperty("per_price_costs") + @ExcludeMissing + private val perPriceCosts: JsonField> = JsonMissing.of(), @JsonProperty("subtotal") @ExcludeMissing private val subtotal: JsonField = JsonMissing.of(), - @JsonProperty("total") + @JsonProperty("timeframe_end") @ExcludeMissing - private val total: JsonField = JsonMissing.of(), + private val timeframeEnd: JsonField = JsonMissing.of(), @JsonProperty("timeframe_start") @ExcludeMissing private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") - @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), - @JsonProperty("per_price_costs") + @JsonProperty("total") @ExcludeMissing - private val perPriceCosts: JsonField> = JsonMissing.of(), + private val total: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun perPriceCosts(): List = perPriceCosts.getRequired("per_price_costs") + /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(): String = subtotal.getRequired("subtotal") - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(): String = total.getRequired("total") + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(): String = total.getRequired("total") - fun perPriceCosts(): List = perPriceCosts.getRequired("per_price_costs") + @JsonProperty("per_price_costs") @ExcludeMissing fun _perPriceCosts() = perPriceCosts /** Total costs for the timeframe, excluding any minimums and discounts. */ @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal - /** Total costs for the timeframe, including any minimums and discounts. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - @JsonProperty("per_price_costs") @ExcludeMissing fun _perPriceCosts() = perPriceCosts + /** Total costs for the timeframe, including any minimums and discounts. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total @JsonAnyGetter @ExcludeMissing @@ -150,11 +150,11 @@ private constructor( fun validate(): Data = apply { if (!validated) { + perPriceCosts().forEach { it.validate() } subtotal() - total() - timeframeStart() timeframeEnd() - perPriceCosts().forEach { it.validate() } + timeframeStart() + total() validated = true } } @@ -168,34 +168,42 @@ private constructor( class Builder { + private var perPriceCosts: JsonField> = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() - private var total: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() private var timeframeEnd: JsonField = JsonMissing.of() - private var perPriceCosts: JsonField> = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { + perPriceCosts = data.perPriceCosts subtotal = data.subtotal - total = data.total - timeframeStart = data.timeframeStart timeframeEnd = data.timeframeEnd - perPriceCosts = data.perPriceCosts + timeframeStart = data.timeframeStart + total = data.total additionalProperties = data.additionalProperties.toMutableMap() } + fun perPriceCosts(perPriceCosts: List) = + perPriceCosts(JsonField.of(perPriceCosts)) + + fun perPriceCosts(perPriceCosts: JsonField>) = apply { + this.perPriceCosts = perPriceCosts + } + /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(total: String) = total(JsonField.of(total)) + fun timeframeEnd(timeframeEnd: OffsetDateTime) = + timeframeEnd(JsonField.of(timeframeEnd)) - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(total: JsonField) = apply { this.total = total } + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } fun timeframeStart(timeframeStart: OffsetDateTime) = timeframeStart(JsonField.of(timeframeStart)) @@ -204,19 +212,11 @@ private constructor( this.timeframeStart = timeframeStart } - fun timeframeEnd(timeframeEnd: OffsetDateTime) = - timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - fun perPriceCosts(perPriceCosts: List) = - perPriceCosts(JsonField.of(perPriceCosts)) + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(total: String) = total(JsonField.of(total)) - fun perPriceCosts(perPriceCosts: JsonField>) = apply { - this.perPriceCosts = perPriceCosts - } + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(total: JsonField) = apply { this.total = total } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -239,11 +239,11 @@ private constructor( fun build(): Data = Data( + perPriceCosts.map { it.toImmutable() }, subtotal, - total, - timeframeStart, timeframeEnd, - perPriceCosts.map { it.toImmutable() }, + timeframeStart, + total, additionalProperties.toImmutable(), ) } @@ -252,31 +252,22 @@ private constructor( class PerPriceCost @JsonCreator private constructor( - @JsonProperty("quantity") + @JsonProperty("price") @ExcludeMissing - private val quantity: JsonField = JsonMissing.of(), + private val price: JsonField = JsonMissing.of(), @JsonProperty("subtotal") @ExcludeMissing private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), - @JsonProperty("price") + @JsonProperty("quantity") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), + private val quantity: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The price's quantity for the timeframe */ - fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) - - /** Price's contributions for the timeframe, excluding any minimums and discounts. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(): String = total.getRequired("total") - /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -507,14 +498,14 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The price's quantity for the timeframe */ - @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - /** Price's contributions for the timeframe, excluding any minimums and discounts. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + fun subtotal(): String = subtotal.getRequired("subtotal") /** Price's contributions for the timeframe, including minimums and discounts. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + fun total(): String = total.getRequired("total") + + /** The price's quantity for the timeframe */ + fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) /** * The Price resource represents a price that can be billed on a subscription, resulting @@ -746,6 +737,15 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price + /** Price's contributions for the timeframe, excluding any minimums and discounts. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** Price's contributions for the timeframe, including minimums and discounts. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total + + /** The price's quantity for the timeframe */ + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -754,10 +754,10 @@ private constructor( fun validate(): PerPriceCost = apply { if (!validated) { - quantity() + price() subtotal() total() - price() + quantity() validated = true } } @@ -771,43 +771,21 @@ private constructor( class Builder { - private var quantity: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() private var total: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() + private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(perPriceCost: PerPriceCost) = apply { - quantity = perPriceCost.quantity + price = perPriceCost.price subtotal = perPriceCost.subtotal total = perPriceCost.total - price = perPriceCost.price + quantity = perPriceCost.quantity additionalProperties = perPriceCost.additionalProperties.toMutableMap() } - /** The price's quantity for the timeframe */ - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - /** The price's quantity for the timeframe */ - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - - /** - * Price's contributions for the timeframe, excluding any minimums and discounts. - */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** - * Price's contributions for the timeframe, excluding any minimums and discounts. - */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(total: String) = total(JsonField.of(total)) - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(total: JsonField) = apply { this.total = total } - /** * The Price resource represents a price that can be billed on a subscription, * resulting in a charge on an invoice in the form of an invoice line item. Prices @@ -1276,6 +1254,28 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } + /** + * Price's contributions for the timeframe, excluding any minimums and discounts. + */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** + * Price's contributions for the timeframe, excluding any minimums and discounts. + */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** Price's contributions for the timeframe, including minimums and discounts. */ + fun total(total: String) = total(JsonField.of(total)) + + /** Price's contributions for the timeframe, including minimums and discounts. */ + fun total(total: JsonField) = apply { this.total = total } + + /** The price's quantity for the timeframe */ + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + /** The price's quantity for the timeframe */ + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1300,10 +1300,10 @@ private constructor( fun build(): PerPriceCost = PerPriceCost( - quantity, + price, subtotal, total, - price, + quantity, additionalProperties.toImmutable(), ) } @@ -1313,17 +1313,17 @@ private constructor( return true } - return /* spotless:off */ other is PerPriceCost && quantity == other.quantity && subtotal == other.subtotal && total == other.total && price == other.price && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PerPriceCost && price == other.price && subtotal == other.subtotal && total == other.total && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(quantity, subtotal, total, price, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(price, subtotal, total, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PerPriceCost{quantity=$quantity, subtotal=$subtotal, total=$total, price=$price, additionalProperties=$additionalProperties}" + "PerPriceCost{price=$price, subtotal=$subtotal, total=$total, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1331,17 +1331,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && subtotal == other.subtotal && total == other.total && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && perPriceCosts == other.perPriceCosts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && perPriceCosts == other.perPriceCosts && subtotal == other.subtotal && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && total == other.total && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(subtotal, total, timeframeStart, timeframeEnd, perPriceCosts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(perPriceCosts, subtotal, timeframeEnd, timeframeStart, total, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{subtotal=$subtotal, total=$total, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, perPriceCosts=$perPriceCosts, additionalProperties=$additionalProperties}" + "Data{perPriceCosts=$perPriceCosts, subtotal=$subtotal, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, total=$total, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt index 9093e277..3a06cae2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt @@ -109,22 +109,40 @@ constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } /** The currency or custom pricing unit to use. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** The currency or custom pricing unit to use. */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** 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: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: Optional) = + timeframeEnd(timeframeEnd.orElse(null)) /** Costs returned are inclusive of `timeframe_start`. */ - fun timeframeStart(timeframeStart: OffsetDateTime) = apply { + fun timeframeStart(timeframeStart: OffsetDateTime?) = apply { this.timeframeStart = timeframeStart } + /** Costs returned are inclusive of `timeframe_start`. */ + fun timeframeStart(timeframeStart: Optional) = + timeframeStart(timeframeStart.orElse(null)) + + /** + * Controls whether Orb returns cumulative costs since the start of the billing period, or + * 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: ViewMode?) = apply { this.viewMode = viewMode } + /** * Controls whether Orb returns cumulative costs since the start of the billing period, or * 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: ViewMode) = apply { this.viewMode = viewMode } + fun viewMode(viewMode: Optional) = viewMode(viewMode.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt index d5a65c63..7e284d2f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt @@ -96,48 +96,48 @@ private constructor( class Data @JsonCreator private constructor( + @JsonProperty("per_price_costs") + @ExcludeMissing + private val perPriceCosts: JsonField> = JsonMissing.of(), @JsonProperty("subtotal") @ExcludeMissing private val subtotal: JsonField = JsonMissing.of(), - @JsonProperty("total") + @JsonProperty("timeframe_end") @ExcludeMissing - private val total: JsonField = JsonMissing.of(), + private val timeframeEnd: JsonField = JsonMissing.of(), @JsonProperty("timeframe_start") @ExcludeMissing private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") - @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), - @JsonProperty("per_price_costs") + @JsonProperty("total") @ExcludeMissing - private val perPriceCosts: JsonField> = JsonMissing.of(), + private val total: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun perPriceCosts(): List = perPriceCosts.getRequired("per_price_costs") + /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(): String = subtotal.getRequired("subtotal") - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(): String = total.getRequired("total") + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(): String = total.getRequired("total") - fun perPriceCosts(): List = perPriceCosts.getRequired("per_price_costs") + @JsonProperty("per_price_costs") @ExcludeMissing fun _perPriceCosts() = perPriceCosts /** Total costs for the timeframe, excluding any minimums and discounts. */ @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal - /** Total costs for the timeframe, including any minimums and discounts. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - @JsonProperty("per_price_costs") @ExcludeMissing fun _perPriceCosts() = perPriceCosts + /** Total costs for the timeframe, including any minimums and discounts. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total @JsonAnyGetter @ExcludeMissing @@ -147,11 +147,11 @@ private constructor( fun validate(): Data = apply { if (!validated) { + perPriceCosts().forEach { it.validate() } subtotal() - total() - timeframeStart() timeframeEnd() - perPriceCosts().forEach { it.validate() } + timeframeStart() + total() validated = true } } @@ -165,34 +165,42 @@ private constructor( class Builder { + private var perPriceCosts: JsonField> = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() - private var total: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() private var timeframeEnd: JsonField = JsonMissing.of() - private var perPriceCosts: JsonField> = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { + perPriceCosts = data.perPriceCosts subtotal = data.subtotal - total = data.total - timeframeStart = data.timeframeStart timeframeEnd = data.timeframeEnd - perPriceCosts = data.perPriceCosts + timeframeStart = data.timeframeStart + total = data.total additionalProperties = data.additionalProperties.toMutableMap() } + fun perPriceCosts(perPriceCosts: List) = + perPriceCosts(JsonField.of(perPriceCosts)) + + fun perPriceCosts(perPriceCosts: JsonField>) = apply { + this.perPriceCosts = perPriceCosts + } + /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(total: String) = total(JsonField.of(total)) + fun timeframeEnd(timeframeEnd: OffsetDateTime) = + timeframeEnd(JsonField.of(timeframeEnd)) - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(total: JsonField) = apply { this.total = total } + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } fun timeframeStart(timeframeStart: OffsetDateTime) = timeframeStart(JsonField.of(timeframeStart)) @@ -201,19 +209,11 @@ private constructor( this.timeframeStart = timeframeStart } - fun timeframeEnd(timeframeEnd: OffsetDateTime) = - timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - fun perPriceCosts(perPriceCosts: List) = - perPriceCosts(JsonField.of(perPriceCosts)) + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(total: String) = total(JsonField.of(total)) - fun perPriceCosts(perPriceCosts: JsonField>) = apply { - this.perPriceCosts = perPriceCosts - } + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(total: JsonField) = apply { this.total = total } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -236,11 +236,11 @@ private constructor( fun build(): Data = Data( + perPriceCosts.map { it.toImmutable() }, subtotal, - total, - timeframeStart, timeframeEnd, - perPriceCosts.map { it.toImmutable() }, + timeframeStart, + total, additionalProperties.toImmutable(), ) } @@ -249,31 +249,22 @@ private constructor( class PerPriceCost @JsonCreator private constructor( - @JsonProperty("quantity") + @JsonProperty("price") @ExcludeMissing - private val quantity: JsonField = JsonMissing.of(), + private val price: JsonField = JsonMissing.of(), @JsonProperty("subtotal") @ExcludeMissing private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), - @JsonProperty("price") + @JsonProperty("quantity") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), + private val quantity: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The price's quantity for the timeframe */ - fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) - - /** Price's contributions for the timeframe, excluding any minimums and discounts. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(): String = total.getRequired("total") - /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -504,14 +495,14 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The price's quantity for the timeframe */ - @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - /** Price's contributions for the timeframe, excluding any minimums and discounts. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + fun subtotal(): String = subtotal.getRequired("subtotal") /** Price's contributions for the timeframe, including minimums and discounts. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + fun total(): String = total.getRequired("total") + + /** The price's quantity for the timeframe */ + fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) /** * The Price resource represents a price that can be billed on a subscription, resulting @@ -743,6 +734,15 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price + /** Price's contributions for the timeframe, excluding any minimums and discounts. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** Price's contributions for the timeframe, including minimums and discounts. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total + + /** The price's quantity for the timeframe */ + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -751,10 +751,10 @@ private constructor( fun validate(): PerPriceCost = apply { if (!validated) { - quantity() + price() subtotal() total() - price() + quantity() validated = true } } @@ -768,43 +768,21 @@ private constructor( class Builder { - private var quantity: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() private var total: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() + private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(perPriceCost: PerPriceCost) = apply { - quantity = perPriceCost.quantity + price = perPriceCost.price subtotal = perPriceCost.subtotal total = perPriceCost.total - price = perPriceCost.price + quantity = perPriceCost.quantity additionalProperties = perPriceCost.additionalProperties.toMutableMap() } - /** The price's quantity for the timeframe */ - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - /** The price's quantity for the timeframe */ - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - - /** - * Price's contributions for the timeframe, excluding any minimums and discounts. - */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** - * Price's contributions for the timeframe, excluding any minimums and discounts. - */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(total: String) = total(JsonField.of(total)) - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(total: JsonField) = apply { this.total = total } - /** * The Price resource represents a price that can be billed on a subscription, * resulting in a charge on an invoice in the form of an invoice line item. Prices @@ -1273,6 +1251,28 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } + /** + * Price's contributions for the timeframe, excluding any minimums and discounts. + */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** + * Price's contributions for the timeframe, excluding any minimums and discounts. + */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** Price's contributions for the timeframe, including minimums and discounts. */ + fun total(total: String) = total(JsonField.of(total)) + + /** Price's contributions for the timeframe, including minimums and discounts. */ + fun total(total: JsonField) = apply { this.total = total } + + /** The price's quantity for the timeframe */ + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + /** The price's quantity for the timeframe */ + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1297,10 +1297,10 @@ private constructor( fun build(): PerPriceCost = PerPriceCost( - quantity, + price, subtotal, total, - price, + quantity, additionalProperties.toImmutable(), ) } @@ -1310,17 +1310,17 @@ private constructor( return true } - return /* spotless:off */ other is PerPriceCost && quantity == other.quantity && subtotal == other.subtotal && total == other.total && price == other.price && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PerPriceCost && price == other.price && subtotal == other.subtotal && total == other.total && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(quantity, subtotal, total, price, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(price, subtotal, total, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PerPriceCost{quantity=$quantity, subtotal=$subtotal, total=$total, price=$price, additionalProperties=$additionalProperties}" + "PerPriceCost{price=$price, subtotal=$subtotal, total=$total, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1328,17 +1328,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && subtotal == other.subtotal && total == other.total && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && perPriceCosts == other.perPriceCosts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && perPriceCosts == other.perPriceCosts && subtotal == other.subtotal && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && total == other.total && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(subtotal, total, timeframeStart, timeframeEnd, perPriceCosts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(perPriceCosts, subtotal, timeframeEnd, timeframeStart, total, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{subtotal=$subtotal, total=$total, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, perPriceCosts=$perPriceCosts, additionalProperties=$additionalProperties}" + "Data{perPriceCosts=$perPriceCosts, subtotal=$subtotal, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, total=$total, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt index 180db77d..b119dfab 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt @@ -517,17 +517,28 @@ constructor( fun name(name: String) = apply { this.name = name } fun accountingSyncConfiguration( - accountingSyncConfiguration: AccountingSyncConfiguration + accountingSyncConfiguration: AccountingSyncConfiguration? ) = apply { this.accountingSyncConfiguration = accountingSyncConfiguration } + fun accountingSyncConfiguration( + accountingSyncConfiguration: Optional + ) = accountingSyncConfiguration(accountingSyncConfiguration.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses * will be CC'd for customer communications. */ - fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails = additionalEmails.toMutableList() + fun additionalEmails(additionalEmails: List?) = apply { + this.additionalEmails = additionalEmails?.toMutableList() } + /** + * Additional email addresses for this customer. If populated, these email addresses + * will be CC'd for customer communications. + */ + fun additionalEmails(additionalEmails: Optional>) = + additionalEmails(additionalEmails.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses * will be CC'd for customer communications. @@ -542,66 +553,137 @@ constructor( * a saved payment method, if available. This parameter defaults to `True` when a * payment provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { + fun autoCollection(autoCollection: Boolean?) = apply { this.autoCollection = autoCollection } - fun billingAddress(billingAddress: BillingAddress) = apply { + /** + * Used to determine if invoices for this customer will automatically attempt to charge + * a saved payment method, if available. This parameter defaults to `True` when a + * payment provider is provided on customer creation. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Used to determine if invoices for this customer will automatically attempt to charge + * a saved payment method, if available. This parameter defaults to `True` when a + * payment provider is provided on customer creation. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) + + fun billingAddress(billingAddress: BillingAddress?) = apply { this.billingAddress = billingAddress } + fun billingAddress(billingAddress: Optional) = + billingAddress(billingAddress.orElse(null)) + + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set + * at creation time, will be set at subscription creation time. + */ + fun currency(currency: String?) = apply { this.currency = currency } + /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set * at creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + fun emailDelivery(emailDelivery: Boolean?) = apply { + this.emailDelivery = emailDelivery + } + + fun emailDelivery(emailDelivery: Boolean) = emailDelivery(emailDelivery as Boolean?) - fun emailDelivery(emailDelivery: Boolean) = apply { this.emailDelivery = emailDelivery } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun emailDelivery(emailDelivery: Optional) = + emailDelivery(emailDelivery.orElse(null) as Boolean?) /** * An optional user-defined ID for this customer resource, used throughout the system as * an alias for this Customer. Use this field to identify a customer by an existing * identifier in your system. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * An optional user-defined ID for this customer resource, used throughout the system as + * an alias for this Customer. Use this field to identify a customer by an existing + * identifier in your system. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) /** * This is used for creating charges or invoices in an external system via Orb. When not * in test mode, the connection must first be configured in the Orb webapp. */ - fun paymentProvider(paymentProvider: PaymentProvider) = apply { + fun paymentProvider(paymentProvider: PaymentProvider?) = apply { this.paymentProvider = paymentProvider } + /** + * This is used for creating charges or invoices in an external system via Orb. When not + * in test mode, the connection must first be configured in the Orb webapp. + */ + fun paymentProvider(paymentProvider: Optional) = + paymentProvider(paymentProvider.orElse(null)) + /** * The ID of this customer in an external payments solution, such as Stripe. This is * used for creating charges or invoices in the external system via Orb. */ - fun paymentProviderId(paymentProviderId: String) = apply { + fun paymentProviderId(paymentProviderId: String?) = apply { this.paymentProviderId = paymentProviderId } - fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { + /** + * The ID of this customer in an external payments solution, such as Stripe. This is + * used for creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(paymentProviderId: Optional) = + paymentProviderId(paymentProviderId.orElse(null)) + + fun reportingConfiguration(reportingConfiguration: ReportingConfiguration?) = apply { this.reportingConfiguration = reportingConfiguration } - fun shippingAddress(shippingAddress: ShippingAddress) = apply { + fun reportingConfiguration(reportingConfiguration: Optional) = + reportingConfiguration(reportingConfiguration.orElse(null)) + + fun shippingAddress(shippingAddress: ShippingAddress?) = apply { this.shippingAddress = shippingAddress } - fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { + fun shippingAddress(shippingAddress: Optional) = + shippingAddress(shippingAddress.orElse(null)) + + fun taxConfiguration(taxConfiguration: TaxConfiguration?) = apply { this.taxConfiguration = taxConfiguration } + fun taxConfiguration(taxConfiguration: Optional) = + taxConfiguration(taxConfiguration.orElse(null)) + fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration ) = apply { @@ -721,14 +803,129 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { this.taxId = taxId } + fun taxId(taxId: TaxId?) = apply { this.taxId = taxId } + + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added + * to the headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (QuĆ©bec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószĆ”m) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna Å”tevilka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(taxId: Optional) = taxId(taxId.orElse(null)) /** * A timezone identifier from the IANA timezone database, such as * `"America/Los_Angeles"`. This defaults to your account's timezone if not set. This * cannot be changed after customer creation. */ - fun timezone(timezone: String) = apply { this.timezone = timezone } + fun timezone(timezone: String?) = apply { this.timezone = timezone } + + /** + * A timezone identifier from the IANA timezone database, such as + * `"America/Los_Angeles"`. This defaults to your account's timezone if not set. This + * cannot be changed after customer creation. + */ + fun timezone(timezone: Optional) = timezone(timezone.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -820,19 +1017,30 @@ constructor( /** The full name of the customer */ fun name(name: String) = apply { body.name(name) } - fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration) = + fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration?) = apply { body.accountingSyncConfiguration(accountingSyncConfiguration) } + fun accountingSyncConfiguration( + accountingSyncConfiguration: Optional + ) = accountingSyncConfiguration(accountingSyncConfiguration.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses will be * CC'd for customer communications. */ - fun additionalEmails(additionalEmails: List) = apply { + fun additionalEmails(additionalEmails: List?) = apply { body.additionalEmails(additionalEmails) } + /** + * Additional email addresses for this customer. If populated, these email addresses will be + * CC'd for customer communications. + */ + fun additionalEmails(additionalEmails: Optional>) = + additionalEmails(additionalEmails.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses will be * CC'd for customer communications. @@ -846,64 +1054,133 @@ constructor( * saved payment method, if available. This parameter defaults to `True` when a payment * provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } + fun autoCollection(autoCollection: Boolean?) = apply { body.autoCollection(autoCollection) } + + /** + * Used to determine if invoices for this customer will automatically attempt to charge a + * saved payment method, if available. This parameter defaults to `True` when a payment + * provider is provided on customer creation. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Used to determine if invoices for this customer will automatically attempt to charge a + * saved payment method, if available. This parameter defaults to `True` when a payment + * provider is provided on customer creation. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) - fun billingAddress(billingAddress: BillingAddress) = apply { + fun billingAddress(billingAddress: BillingAddress?) = apply { body.billingAddress(billingAddress) } + fun billingAddress(billingAddress: Optional) = + billingAddress(billingAddress.orElse(null)) + + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set at + * creation time, will be set at subscription creation time. + */ + fun currency(currency: String?) = apply { body.currency(currency) } + /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set at * creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { body.currency(currency) } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + fun emailDelivery(emailDelivery: Boolean?) = apply { body.emailDelivery(emailDelivery) } + + fun emailDelivery(emailDelivery: Boolean) = emailDelivery(emailDelivery as Boolean?) - fun emailDelivery(emailDelivery: Boolean) = apply { body.emailDelivery(emailDelivery) } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun emailDelivery(emailDelivery: Optional) = + emailDelivery(emailDelivery.orElse(null) as Boolean?) /** * An optional user-defined ID for this customer resource, used throughout the system as an * alias for this Customer. Use this field to identify a customer by an existing identifier * in your system. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } + /** + * An optional user-defined ID for this customer resource, used throughout the system as an + * alias for this Customer. Use this field to identify a customer by an existing identifier + * in your system. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } + /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) /** * This is used for creating charges or invoices in an external system via Orb. When not in * test mode, the connection must first be configured in the Orb webapp. */ - fun paymentProvider(paymentProvider: PaymentProvider) = apply { + fun paymentProvider(paymentProvider: PaymentProvider?) = apply { body.paymentProvider(paymentProvider) } + /** + * This is used for creating charges or invoices in an external system via Orb. When not in + * test mode, the connection must first be configured in the Orb webapp. + */ + fun paymentProvider(paymentProvider: Optional) = + paymentProvider(paymentProvider.orElse(null)) + /** * The ID of this customer in an external payments solution, such as Stripe. This is used * for creating charges or invoices in the external system via Orb. */ - fun paymentProviderId(paymentProviderId: String) = apply { + fun paymentProviderId(paymentProviderId: String?) = apply { body.paymentProviderId(paymentProviderId) } - fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { + /** + * The ID of this customer in an external payments solution, such as Stripe. This is used + * for creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(paymentProviderId: Optional) = + paymentProviderId(paymentProviderId.orElse(null)) + + fun reportingConfiguration(reportingConfiguration: ReportingConfiguration?) = apply { body.reportingConfiguration(reportingConfiguration) } - fun shippingAddress(shippingAddress: ShippingAddress) = apply { + fun reportingConfiguration(reportingConfiguration: Optional) = + reportingConfiguration(reportingConfiguration.orElse(null)) + + fun shippingAddress(shippingAddress: ShippingAddress?) = apply { body.shippingAddress(shippingAddress) } - fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { + fun shippingAddress(shippingAddress: Optional) = + shippingAddress(shippingAddress.orElse(null)) + + fun taxConfiguration(taxConfiguration: TaxConfiguration?) = apply { body.taxConfiguration(taxConfiguration) } + fun taxConfiguration(taxConfiguration: Optional) = + taxConfiguration(taxConfiguration.orElse(null)) + fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration ) = apply { body.taxConfiguration(newAvalaraTaxConfiguration) } @@ -1019,14 +1296,129 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { body.taxId(taxId) } + fun taxId(taxId: TaxId?) = apply { body.taxId(taxId) } + + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added to + * the headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (QuĆ©bec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószĆ”m) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna Å”tevilka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(taxId: Optional) = taxId(taxId.orElse(null)) /** * A timezone identifier from the IANA timezone database, such as `"America/Los_Angeles"`. * This defaults to your account's timezone if not set. This cannot be changed after * customer creation. */ - fun timezone(timezone: String) = apply { body.timezone(timezone) } + fun timezone(timezone: String?) = apply { body.timezone(timezone) } + + /** + * A timezone identifier from the IANA timezone database, such as `"America/Los_Angeles"`. + * This defaults to your account's timezone if not set. This cannot be changed after + * customer creation. + */ + fun timezone(timezone: Optional) = timezone(timezone.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -1157,19 +1549,19 @@ constructor( class AccountingSyncConfiguration @JsonCreator private constructor( - @JsonProperty("excluded") private val excluded: Boolean?, @JsonProperty("accounting_providers") private val accountingProviders: List?, + @JsonProperty("excluded") private val excluded: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("excluded") fun excluded(): Optional = Optional.ofNullable(excluded) - @JsonProperty("accounting_providers") fun accountingProviders(): Optional> = Optional.ofNullable(accountingProviders) + @JsonProperty("excluded") fun excluded(): Optional = Optional.ofNullable(excluded) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1183,30 +1575,38 @@ constructor( class Builder { - private var excluded: Boolean? = null private var accountingProviders: MutableList? = null + private var excluded: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingSyncConfiguration: AccountingSyncConfiguration) = apply { - excluded = accountingSyncConfiguration.excluded accountingProviders = accountingSyncConfiguration.accountingProviders?.toMutableList() + excluded = accountingSyncConfiguration.excluded additionalProperties = accountingSyncConfiguration.additionalProperties.toMutableMap() } - fun excluded(excluded: Boolean) = apply { this.excluded = excluded } - - fun accountingProviders(accountingProviders: List) = apply { - this.accountingProviders = accountingProviders.toMutableList() + fun accountingProviders(accountingProviders: List?) = apply { + this.accountingProviders = accountingProviders?.toMutableList() } + fun accountingProviders(accountingProviders: Optional>) = + accountingProviders(accountingProviders.orElse(null)) + fun addAccountingProvider(accountingProvider: AccountingProvider) = apply { accountingProviders = (accountingProviders ?: mutableListOf()).apply { add(accountingProvider) } } + fun excluded(excluded: Boolean?) = apply { this.excluded = excluded } + + fun excluded(excluded: Boolean) = excluded(excluded as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun excluded(excluded: Optional) = excluded(excluded.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1228,8 +1628,8 @@ constructor( fun build(): AccountingSyncConfiguration = AccountingSyncConfiguration( - excluded, accountingProviders?.toImmutable(), + excluded, additionalProperties.toImmutable(), ) } @@ -1238,17 +1638,17 @@ constructor( class AccountingProvider @JsonCreator private constructor( - @JsonProperty("provider_type") private val providerType: String, @JsonProperty("external_provider_id") private val externalProviderId: String, + @JsonProperty("provider_type") private val providerType: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("provider_type") fun providerType(): String = providerType - @JsonProperty("external_provider_id") fun externalProviderId(): String = externalProviderId + @JsonProperty("provider_type") fun providerType(): String = providerType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1262,23 +1662,23 @@ constructor( class Builder { - private var providerType: String? = null private var externalProviderId: String? = null + private var providerType: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingProvider: AccountingProvider) = apply { - providerType = accountingProvider.providerType externalProviderId = accountingProvider.externalProviderId + providerType = accountingProvider.providerType additionalProperties = accountingProvider.additionalProperties.toMutableMap() } - fun providerType(providerType: String) = apply { this.providerType = providerType } - fun externalProviderId(externalProviderId: String) = apply { this.externalProviderId = externalProviderId } + fun providerType(providerType: String) = apply { this.providerType = providerType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1303,10 +1703,10 @@ constructor( fun build(): AccountingProvider = AccountingProvider( - checkNotNull(providerType) { "`providerType` is required but was not set" }, checkNotNull(externalProviderId) { "`externalProviderId` is required but was not set" }, + checkNotNull(providerType) { "`providerType` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -1316,17 +1716,17 @@ constructor( return true } - return /* spotless:off */ other is AccountingProvider && providerType == other.providerType && externalProviderId == other.externalProviderId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingProvider && externalProviderId == other.externalProviderId && providerType == other.providerType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(providerType, externalProviderId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalProviderId, providerType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingProvider{providerType=$providerType, externalProviderId=$externalProviderId, additionalProperties=$additionalProperties}" + "AccountingProvider{externalProviderId=$externalProviderId, providerType=$providerType, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1334,45 +1734,45 @@ constructor( return true } - return /* spotless:off */ other is AccountingSyncConfiguration && excluded == other.excluded && accountingProviders == other.accountingProviders && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingSyncConfiguration && accountingProviders == other.accountingProviders && excluded == other.excluded && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(excluded, accountingProviders, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountingProviders, excluded, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingSyncConfiguration{excluded=$excluded, accountingProviders=$accountingProviders, additionalProperties=$additionalProperties}" + "AccountingSyncConfiguration{accountingProviders=$accountingProviders, excluded=$excluded, additionalProperties=$additionalProperties}" } @NoAutoDetect class BillingAddress @JsonCreator private constructor( + @JsonProperty("city") private val city: String?, + @JsonProperty("country") private val country: String?, @JsonProperty("line1") private val line1: String?, @JsonProperty("line2") private val line2: String?, - @JsonProperty("city") private val city: String?, - @JsonProperty("state") private val state: String?, @JsonProperty("postal_code") private val postalCode: String?, - @JsonProperty("country") private val country: String?, + @JsonProperty("state") private val state: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) + @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) - @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) + @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) - @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) + @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) - @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) + @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) @JsonProperty("postal_code") fun postalCode(): Optional = Optional.ofNullable(postalCode) - @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) + @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) @JsonAnyGetter @ExcludeMissing @@ -1387,36 +1787,48 @@ constructor( class Builder { + private var city: String? = null + private var country: String? = null private var line1: String? = null private var line2: String? = null - private var city: String? = null - private var state: String? = null private var postalCode: String? = null - private var country: String? = null + private var state: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(billingAddress: BillingAddress) = apply { + city = billingAddress.city + country = billingAddress.country line1 = billingAddress.line1 line2 = billingAddress.line2 - city = billingAddress.city - state = billingAddress.state postalCode = billingAddress.postalCode - country = billingAddress.country + state = billingAddress.state additionalProperties = billingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = apply { this.line1 = line1 } + fun city(city: String?) = apply { this.city = city } + + fun city(city: Optional) = city(city.orElse(null)) + + fun country(country: String?) = apply { this.country = country } + + fun country(country: Optional) = country(country.orElse(null)) + + fun line1(line1: String?) = apply { this.line1 = line1 } + + fun line1(line1: Optional) = line1(line1.orElse(null)) - fun line2(line2: String) = apply { this.line2 = line2 } + fun line2(line2: String?) = apply { this.line2 = line2 } - fun city(city: String) = apply { this.city = city } + fun line2(line2: Optional) = line2(line2.orElse(null)) - fun state(state: String) = apply { this.state = state } + fun postalCode(postalCode: String?) = apply { this.postalCode = postalCode } - fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null)) - fun country(country: String) = apply { this.country = country } + fun state(state: String?) = apply { this.state = state } + + fun state(state: Optional) = state(state.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1439,12 +1851,12 @@ constructor( fun build(): BillingAddress = BillingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1454,17 +1866,17 @@ constructor( return true } - return /* spotless:off */ other is BillingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BillingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BillingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "BillingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } /** @@ -1697,28 +2109,28 @@ constructor( class ShippingAddress @JsonCreator private constructor( + @JsonProperty("city") private val city: String?, + @JsonProperty("country") private val country: String?, @JsonProperty("line1") private val line1: String?, @JsonProperty("line2") private val line2: String?, - @JsonProperty("city") private val city: String?, - @JsonProperty("state") private val state: String?, @JsonProperty("postal_code") private val postalCode: String?, - @JsonProperty("country") private val country: String?, + @JsonProperty("state") private val state: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) + @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) - @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) + @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) - @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) + @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) - @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) + @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) @JsonProperty("postal_code") fun postalCode(): Optional = Optional.ofNullable(postalCode) - @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) + @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) @JsonAnyGetter @ExcludeMissing @@ -1733,36 +2145,48 @@ constructor( class Builder { + private var city: String? = null + private var country: String? = null private var line1: String? = null private var line2: String? = null - private var city: String? = null - private var state: String? = null private var postalCode: String? = null - private var country: String? = null + private var state: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(shippingAddress: ShippingAddress) = apply { + city = shippingAddress.city + country = shippingAddress.country line1 = shippingAddress.line1 line2 = shippingAddress.line2 - city = shippingAddress.city - state = shippingAddress.state postalCode = shippingAddress.postalCode - country = shippingAddress.country + state = shippingAddress.state additionalProperties = shippingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = apply { this.line1 = line1 } + fun city(city: String?) = apply { this.city = city } - fun line2(line2: String) = apply { this.line2 = line2 } + fun city(city: Optional) = city(city.orElse(null)) - fun city(city: String) = apply { this.city = city } + fun country(country: String?) = apply { this.country = country } - fun state(state: String) = apply { this.state = state } + fun country(country: Optional) = country(country.orElse(null)) - fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + fun line1(line1: String?) = apply { this.line1 = line1 } - fun country(country: String) = apply { this.country = country } + fun line1(line1: Optional) = line1(line1.orElse(null)) + + fun line2(line2: String?) = apply { this.line2 = line2 } + + fun line2(line2: Optional) = line2(line2.orElse(null)) + + fun postalCode(postalCode: String?) = apply { this.postalCode = postalCode } + + fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null)) + + fun state(state: String?) = apply { this.state = state } + + fun state(state: Optional) = state(state.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1785,12 +2209,12 @@ constructor( fun build(): ShippingAddress = ShippingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1800,17 +2224,17 @@ constructor( return true } - return /* spotless:off */ other is ShippingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ShippingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ShippingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } @JsonDeserialize(using = TaxConfiguration.Deserializer::class) @@ -1986,10 +2410,13 @@ constructor( fun taxProvider(taxProvider: TaxProvider) = apply { this.taxProvider = taxProvider } - fun taxExemptionCode(taxExemptionCode: String) = apply { + fun taxExemptionCode(taxExemptionCode: String?) = apply { this.taxExemptionCode = taxExemptionCode } + fun taxExemptionCode(taxExemptionCode: Optional) = + taxExemptionCode(taxExemptionCode.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt index d1539601..b614b8e3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt @@ -611,25 +611,26 @@ constructor( class AddIncrementCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("amount") private val amount: Double, + @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("currency") private val currency: String?, @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("amount") private val amount: Double, - @JsonProperty("expiry_date") private val expiryDate: OffsetDateTime?, @JsonProperty("effective_date") private val effectiveDate: OffsetDateTime?, - @JsonProperty("per_unit_cost_basis") private val perUnitCostBasis: String?, + @JsonProperty("expiry_date") private val expiryDate: OffsetDateTime?, @JsonProperty("invoice_settings") private val invoiceSettings: InvoiceSettings?, + @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("per_unit_cost_basis") private val perUnitCostBasis: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -645,24 +646,31 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * An ISO 8601 format date that denotes when this credit balance should become available for + * use. */ - @JsonProperty("amount") fun amount(): Double = amount + @JsonProperty("effective_date") + fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) /** An ISO 8601 format date that denotes when this credit balance should expire. */ @JsonProperty("expiry_date") fun expiryDate(): Optional = Optional.ofNullable(expiryDate) /** - * An ISO 8601 format date that denotes when this credit balance should become available for - * use. + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the + * calculation of the invoice total is done on that basis. */ - @JsonProperty("effective_date") - fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) + @JsonProperty("invoice_settings") + fun invoiceSettings(): Optional = Optional.ofNullable(invoiceSettings) + + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) /** * Can only be specified when entry_type=increment. How much, in the customer's currency, a @@ -671,14 +679,6 @@ constructor( @JsonProperty("per_unit_cost_basis") fun perUnitCostBasis(): Optional = Optional.ofNullable(perUnitCostBasis) - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the - * calculation of the invoice total is done on that basis. - */ - @JsonProperty("invoice_settings") - fun invoiceSettings(): Optional = Optional.ofNullable(invoiceSettings) - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -692,15 +692,15 @@ constructor( class Builder { - private var metadata: Metadata? = null + private var amount: Double? = null + private var entryType: EntryType? = null private var currency: String? = null private var description: String? = null - private var entryType: EntryType? = null - private var amount: Double? = null - private var expiryDate: OffsetDateTime? = null private var effectiveDate: OffsetDateTime? = null - private var perUnitCostBasis: String? = null + private var expiryDate: OffsetDateTime? = null private var invoiceSettings: InvoiceSettings? = null + private var metadata: Metadata? = null + private var perUnitCostBasis: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -708,75 +708,121 @@ constructor( addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams ) = apply { - metadata = addIncrementCreditLedgerEntryRequestParams.metadata + amount = addIncrementCreditLedgerEntryRequestParams.amount + entryType = addIncrementCreditLedgerEntryRequestParams.entryType currency = addIncrementCreditLedgerEntryRequestParams.currency description = addIncrementCreditLedgerEntryRequestParams.description - entryType = addIncrementCreditLedgerEntryRequestParams.entryType - amount = addIncrementCreditLedgerEntryRequestParams.amount - expiryDate = addIncrementCreditLedgerEntryRequestParams.expiryDate effectiveDate = addIncrementCreditLedgerEntryRequestParams.effectiveDate - perUnitCostBasis = addIncrementCreditLedgerEntryRequestParams.perUnitCostBasis + expiryDate = addIncrementCreditLedgerEntryRequestParams.expiryDate invoiceSettings = addIncrementCreditLedgerEntryRequestParams.invoiceSettings + metadata = addIncrementCreditLedgerEntryRequestParams.metadata + perUnitCostBasis = addIncrementCreditLedgerEntryRequestParams.perUnitCostBasis additionalProperties = addIncrementCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(amount: Double) = apply { this.amount = amount } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun currency(currency: String?) = apply { this.currency = currency } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } - - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun description(description: String?) = apply { this.description = description } /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. */ - fun amount(amount: Double) = apply { this.amount = amount } - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: OffsetDateTime) = apply { this.expiryDate = expiryDate } + fun description(description: Optional) = description(description.orElse(null)) /** * An ISO 8601 format date that denotes when this credit balance should become available * for use. */ - fun effectiveDate(effectiveDate: OffsetDateTime) = apply { + fun effectiveDate(effectiveDate: OffsetDateTime?) = apply { this.effectiveDate = effectiveDate } /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block + * An ISO 8601 format date that denotes when this credit balance should become available + * for use. */ - fun perUnitCostBasis(perUnitCostBasis: String) = apply { - this.perUnitCostBasis = perUnitCostBasis - } + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) + + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: OffsetDateTime?) = apply { this.expiryDate = expiryDate } + + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) /** * Passing `invoice_settings` automatically generates an invoice for the newly added * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as * the calculation of the invoice total is done on that basis. */ - fun invoiceSettings(invoiceSettings: InvoiceSettings) = apply { + fun invoiceSettings(invoiceSettings: InvoiceSettings?) = apply { this.invoiceSettings = invoiceSettings } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as + * the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(invoiceSettings: Optional) = + invoiceSettings(invoiceSettings.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: String?) = apply { + this.perUnitCostBasis = perUnitCostBasis + } + + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: Optional) = + perUnitCostBasis(perUnitCostBasis.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -798,15 +844,15 @@ constructor( fun build(): AddIncrementCreditLedgerEntryRequestParams = AddIncrementCreditLedgerEntryRequestParams( - metadata, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, currency, description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, - expiryDate, effectiveDate, - perUnitCostBasis, + expiryDate, invoiceSettings, + metadata, + perUnitCostBasis, additionalProperties.toImmutable(), ) } @@ -947,16 +993,34 @@ constructor( fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } /** An optional memo to display on the invoice. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String?) = apply { this.memo = memo } + + /** An optional memo to display on the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) /** * If true, the new credit block will require that the corresponding invoice is paid * before it can be drawn down from. */ - fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = apply { + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean?) = apply { this.requireSuccessfulPayment = requireSuccessfulPayment } + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = + requireSuccessfulPayment(requireSuccessfulPayment as Boolean?) + + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun requireSuccessfulPayment(requireSuccessfulPayment: Optional) = + requireSuccessfulPayment(requireSuccessfulPayment.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1089,38 +1153,39 @@ constructor( return true } - return /* spotless:off */ other is AddIncrementCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && expiryDate == other.expiryDate && effectiveDate == other.effectiveDate && perUnitCostBasis == other.perUnitCostBasis && invoiceSettings == other.invoiceSettings && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddIncrementCreditLedgerEntryRequestParams && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && invoiceSettings == other.invoiceSettings && metadata == other.metadata && perUnitCostBasis == other.perUnitCostBasis && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, expiryDate, effectiveDate, perUnitCostBasis, invoiceSettings, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, effectiveDate, expiryDate, invoiceSettings, metadata, perUnitCostBasis, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddIncrementCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, expiryDate=$expiryDate, effectiveDate=$effectiveDate, perUnitCostBasis=$perUnitCostBasis, invoiceSettings=$invoiceSettings, additionalProperties=$additionalProperties}" + "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddDecrementCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("amount") private val amount: Double, + @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("currency") private val currency: String?, @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("amount") private val amount: Double, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -1136,13 +1201,12 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * User-specified key/value pairs for the resource. 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("amount") fun amount(): Double = amount + @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -1157,11 +1221,11 @@ constructor( class Builder { - private var metadata: Metadata? = null + private var amount: Double? = null + private var entryType: EntryType? = null private var currency: String? = null private var description: String? = null - private var entryType: EntryType? = null - private var amount: Double? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1169,42 +1233,62 @@ constructor( addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams ) = apply { - metadata = addDecrementCreditLedgerEntryRequestParams.metadata + amount = addDecrementCreditLedgerEntryRequestParams.amount + entryType = addDecrementCreditLedgerEntryRequestParams.entryType currency = addDecrementCreditLedgerEntryRequestParams.currency description = addDecrementCreditLedgerEntryRequestParams.description - entryType = addDecrementCreditLedgerEntryRequestParams.entryType - amount = addDecrementCreditLedgerEntryRequestParams.amount + metadata = addDecrementCreditLedgerEntryRequestParams.metadata additionalProperties = addDecrementCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(amount: Double) = apply { this.amount = amount } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun currency(currency: String?) = apply { this.currency = currency } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * User-specified key/value pairs for the resource. 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 amount(amount: Double) = apply { this.amount = amount } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1227,11 +1311,11 @@ constructor( fun build(): AddDecrementCreditLedgerEntryRequestParams = AddDecrementCreditLedgerEntryRequestParams( - metadata, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, currency, description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -1367,57 +1451,46 @@ constructor( return true } - return /* spotless:off */ other is AddDecrementCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddDecrementCreditLedgerEntryRequestParams && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddDecrementCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, additionalProperties=$additionalProperties}" + "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddExpirationChangeCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("currency") private val currency: String?, - @JsonProperty("description") private val description: String?, @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("amount") private val amount: Double?, @JsonProperty("expiry_date") private val expiryDate: OffsetDateTime?, - @JsonProperty("block_id") private val blockId: String?, @JsonProperty("target_expiry_date") private val targetExpiryDate: LocalDate, + @JsonProperty("amount") private val amount: Double?, + @JsonProperty("block_id") private val blockId: String?, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("description") private val description: String?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("entry_type") fun entryType(): EntryType = entryType + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + @JsonProperty("expiry_date") + fun expiryDate(): Optional = Optional.ofNullable(expiryDate) + /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when + * credits transferred (as part of a partial block expiration) should expire. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") fun currency(): Optional = Optional.ofNullable(currency) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - fun description(): Optional = Optional.ofNullable(description) - - @JsonProperty("entry_type") fun entryType(): EntryType = entryType + @JsonProperty("target_expiry_date") fun targetExpiryDate(): LocalDate = targetExpiryDate /** * The number of credits to effect. Note that this is required for increment, decrement, @@ -1425,10 +1498,6 @@ constructor( */ @JsonProperty("amount") fun amount(): Optional = Optional.ofNullable(amount) - /** An ISO 8601 format date that identifies the origination credit block to expire */ - @JsonProperty("expiry_date") - fun expiryDate(): Optional = Optional.ofNullable(expiryDate) - /** * The ID of the block affected by an expiration_change, used to differentiate between * multiple blocks with the same `expiry_date`. @@ -1436,10 +1505,25 @@ constructor( @JsonProperty("block_id") fun blockId(): Optional = Optional.ofNullable(blockId) /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when - * credits transferred (as part of a partial block expiration) should expire. + * The currency or custom pricing unit to use for this ledger entry. If this is a real-world + * currency, it must match the customer's invoicing currency. */ - @JsonProperty("target_expiry_date") fun targetExpiryDate(): LocalDate = targetExpiryDate + @JsonProperty("currency") fun currency(): Optional = Optional.ofNullable(currency) + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + fun description(): Optional = Optional.ofNullable(description) + + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -1454,14 +1538,14 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var currency: String? = null - private var description: String? = null private var entryType: EntryType? = null - private var amount: Double? = null private var expiryDate: OffsetDateTime? = null - private var blockId: String? = null private var targetExpiryDate: LocalDate? = null + private var amount: Double? = null + private var blockId: String? = null + private var currency: String? = null + private var description: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1469,64 +1553,107 @@ constructor( addExpirationChangeCreditLedgerEntryRequestParams: AddExpirationChangeCreditLedgerEntryRequestParams ) = apply { - metadata = addExpirationChangeCreditLedgerEntryRequestParams.metadata - currency = addExpirationChangeCreditLedgerEntryRequestParams.currency - description = addExpirationChangeCreditLedgerEntryRequestParams.description entryType = addExpirationChangeCreditLedgerEntryRequestParams.entryType - amount = addExpirationChangeCreditLedgerEntryRequestParams.amount expiryDate = addExpirationChangeCreditLedgerEntryRequestParams.expiryDate - blockId = addExpirationChangeCreditLedgerEntryRequestParams.blockId targetExpiryDate = addExpirationChangeCreditLedgerEntryRequestParams.targetExpiryDate + amount = addExpirationChangeCreditLedgerEntryRequestParams.amount + blockId = addExpirationChangeCreditLedgerEntryRequestParams.blockId + currency = addExpirationChangeCreditLedgerEntryRequestParams.currency + description = addExpirationChangeCreditLedgerEntryRequestParams.description + metadata = addExpirationChangeCreditLedgerEntryRequestParams.metadata additionalProperties = addExpirationChangeCreditLedgerEntryRequestParams.additionalProperties .toMutableMap() } + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + fun expiryDate(expiryDate: OffsetDateTime?) = apply { this.expiryDate = expiryDate } + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) + /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting + * when credits transferred (as part of a partial block expiration) should expire. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun targetExpiryDate(targetExpiryDate: LocalDate) = apply { + this.targetExpiryDate = targetExpiryDate + } /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun currency(currency: String) = apply { this.currency = currency } + fun amount(amount: Double?) = apply { this.amount = amount } /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun description(description: String) = apply { this.description = description } - - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun amount(amount: Double) = amount(amount as Double?) /** * The number of credits to effect. Note that this is required for increment, decrement, * void, or undo operations. */ - fun amount(amount: Double) = apply { this.amount = amount } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Double?) - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: OffsetDateTime) = apply { this.expiryDate = expiryDate } + /** + * The ID of the block affected by an expiration_change, used to differentiate between + * multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: String?) = apply { this.blockId = blockId } /** * The ID of the block affected by an expiration_change, used to differentiate between * multiple blocks with the same `expiry_date`. */ - fun blockId(blockId: String) = apply { this.blockId = blockId } + fun blockId(blockId: Optional) = blockId(blockId.orElse(null)) /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting - * when credits transferred (as part of a partial block expiration) should expire. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun targetExpiryDate(targetExpiryDate: LocalDate) = apply { - this.targetExpiryDate = targetExpiryDate - } + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: String?) = apply { this.description = description } + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1549,16 +1676,16 @@ constructor( fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = AddExpirationChangeCreditLedgerEntryRequestParams( - metadata, - currency, - description, checkNotNull(entryType) { "`entryType` is required but was not set" }, - amount, expiryDate, - blockId, checkNotNull(targetExpiryDate) { "`targetExpiryDate` is required but was not set" }, + amount, + blockId, + currency, + description, + metadata, additionalProperties.toImmutable(), ) } @@ -1694,40 +1821,44 @@ constructor( return true } - return /* spotless:off */ other is AddExpirationChangeCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && expiryDate == other.expiryDate && blockId == other.blockId && targetExpiryDate == other.targetExpiryDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddExpirationChangeCreditLedgerEntryRequestParams && entryType == other.entryType && expiryDate == other.expiryDate && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, expiryDate, blockId, targetExpiryDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddExpirationChangeCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, expiryDate=$expiryDate, blockId=$blockId, targetExpiryDate=$targetExpiryDate, additionalProperties=$additionalProperties}" + "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddVoidCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("amount") private val amount: Double, + @JsonProperty("block_id") private val blockId: String, + @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("currency") private val currency: String?, @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("block_id") private val blockId: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("void_reason") private val voidReason: VoidReason?, - @JsonProperty("amount") private val amount: Double, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + /** The ID of the block to void. */ + @JsonProperty("block_id") fun blockId(): String = blockId + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -1743,21 +1874,17 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - - /** The ID of the block to void. */ - @JsonProperty("block_id") fun blockId(): String = blockId + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) /** Can only be specified when `entry_type=void`. The reason for the void. */ @JsonProperty("void_reason") fun voidReason(): Optional = Optional.ofNullable(voidReason) - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") fun amount(): Double = amount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1771,63 +1898,86 @@ constructor( class Builder { - private var metadata: Metadata? = null + private var amount: Double? = null + private var blockId: String? = null + private var entryType: EntryType? = null private var currency: String? = null private var description: String? = null - private var entryType: EntryType? = null - private var blockId: String? = null + private var metadata: Metadata? = null private var voidReason: VoidReason? = null - private var amount: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams ) = apply { - metadata = addVoidCreditLedgerEntryRequestParams.metadata + amount = addVoidCreditLedgerEntryRequestParams.amount + blockId = addVoidCreditLedgerEntryRequestParams.blockId + entryType = addVoidCreditLedgerEntryRequestParams.entryType currency = addVoidCreditLedgerEntryRequestParams.currency description = addVoidCreditLedgerEntryRequestParams.description - entryType = addVoidCreditLedgerEntryRequestParams.entryType - blockId = addVoidCreditLedgerEntryRequestParams.blockId + metadata = addVoidCreditLedgerEntryRequestParams.metadata voidReason = addVoidCreditLedgerEntryRequestParams.voidReason - amount = addVoidCreditLedgerEntryRequestParams.amount additionalProperties = addVoidCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(amount: Double) = apply { this.amount = amount } + + /** The ID of the block to void. */ + fun blockId(blockId: String) = apply { this.blockId = blockId } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun currency(currency: String?) = apply { this.currency = currency } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } - - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun description(description: String?) = apply { this.description = description } - /** The ID of the block to void. */ - fun blockId(blockId: String) = apply { this.blockId = blockId } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: VoidReason) = apply { this.voidReason = voidReason } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * User-specified key/value pairs for the resource. 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 amount(amount: Double) = apply { this.amount = amount } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: VoidReason?) = apply { this.voidReason = voidReason } + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: Optional) = voidReason(voidReason.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1850,13 +2000,13 @@ constructor( fun build(): AddVoidCreditLedgerEntryRequestParams = AddVoidCreditLedgerEntryRequestParams( - metadata, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(blockId) { "`blockId` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, currency, description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, - checkNotNull(blockId) { "`blockId` is required but was not set" }, + metadata, voidReason, - checkNotNull(amount) { "`amount` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -2043,39 +2193,43 @@ constructor( return true } - return /* spotless:off */ other is AddVoidCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && blockId == other.blockId && voidReason == other.voidReason && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddVoidCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, blockId, voidReason, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddVoidCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, blockId=$blockId, voidReason=$voidReason, amount=$amount, additionalProperties=$additionalProperties}" + "AddVoidCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddAmendmentCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("currency") private val currency: String?, - @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("amount") private val amount: Double, @JsonProperty("block_id") private val blockId: String, + @JsonProperty("entry_type") private val entryType: EntryType, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("description") private val description: String?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement or + * void operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + /** The ID of the block to reverse a decrement from. */ + @JsonProperty("block_id") fun blockId(): String = blockId + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -2091,16 +2245,12 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - /** - * The number of credits to effect. Note that this is required for increment, decrement or - * void operations. + * User-specified key/value pairs for the resource. 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("amount") fun amount(): Double = amount - - /** The ID of the block to reverse a decrement from. */ - @JsonProperty("block_id") fun blockId(): String = blockId + @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -2115,12 +2265,12 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var currency: String? = null - private var description: String? = null - private var entryType: EntryType? = null private var amount: Double? = null private var blockId: String? = null + private var entryType: EntryType? = null + private var currency: String? = null + private var description: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2128,46 +2278,66 @@ constructor( addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams ) = apply { - metadata = addAmendmentCreditLedgerEntryRequestParams.metadata - currency = addAmendmentCreditLedgerEntryRequestParams.currency - description = addAmendmentCreditLedgerEntryRequestParams.description - entryType = addAmendmentCreditLedgerEntryRequestParams.entryType amount = addAmendmentCreditLedgerEntryRequestParams.amount blockId = addAmendmentCreditLedgerEntryRequestParams.blockId + entryType = addAmendmentCreditLedgerEntryRequestParams.entryType + currency = addAmendmentCreditLedgerEntryRequestParams.currency + description = addAmendmentCreditLedgerEntryRequestParams.description + metadata = addAmendmentCreditLedgerEntryRequestParams.metadata additionalProperties = addAmendmentCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement + * or void operations. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun amount(amount: Double) = apply { this.amount = amount } + + /** The ID of the block to reverse a decrement from. */ + fun blockId(blockId: String) = apply { this.blockId = blockId } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) /** - * The number of credits to effect. Note that this is required for increment, decrement - * or void operations. + * User-specified key/value pairs for the resource. 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 amount(amount: Double) = apply { this.amount = amount } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** The ID of the block to reverse a decrement from. */ - fun blockId(blockId: String) = apply { this.blockId = blockId } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2190,12 +2360,12 @@ constructor( fun build(): AddAmendmentCreditLedgerEntryRequestParams = AddAmendmentCreditLedgerEntryRequestParams( - metadata, - currency, - description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, checkNotNull(amount) { "`amount` is required but was not set" }, checkNotNull(blockId) { "`blockId` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, + currency, + description, + metadata, additionalProperties.toImmutable(), ) } @@ -2331,17 +2501,17 @@ constructor( return true } - return /* spotless:off */ other is AddAmendmentCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && blockId == other.blockId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddAmendmentCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, blockId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddAmendmentCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, blockId=$blockId, additionalProperties=$additionalProperties}" + "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt index 6808c3e6..aeba2f02 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt @@ -379,112 +379,112 @@ private constructor( class IncrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -494,19 +494,19 @@ private constructor( fun validate(): IncrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -520,79 +520,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - metadata = incrementLedgerEntry.metadata id = incrementLedgerEntry.id - ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber - entryStatus = incrementLedgerEntry.entryStatus - customer = incrementLedgerEntry.customer - startingBalance = incrementLedgerEntry.startingBalance - endingBalance = incrementLedgerEntry.endingBalance amount = incrementLedgerEntry.amount - currency = incrementLedgerEntry.currency createdAt = incrementLedgerEntry.createdAt - description = incrementLedgerEntry.description creditBlock = incrementLedgerEntry.creditBlock + currency = incrementLedgerEntry.currency + customer = incrementLedgerEntry.customer + description = incrementLedgerEntry.description + endingBalance = incrementLedgerEntry.endingBalance + entryStatus = incrementLedgerEntry.entryStatus entryType = incrementLedgerEntry.entryType + ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber + metadata = incrementLedgerEntry.metadata + startingBalance = incrementLedgerEntry.startingBalance additionalProperties = incrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -601,36 +593,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -652,19 +652,19 @@ private constructor( fun build(): IncrementLedgerEntry = IncrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -1119,151 +1119,151 @@ private constructor( return true } - return /* spotless:off */ other is IncrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IncrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IncrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "IncrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class DecrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("price_id") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("event_id") @ExcludeMissing private val eventId: JsonField = JsonMissing.of(), @JsonProperty("invoice_id") @ExcludeMissing private val invoiceId: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + /** + * 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("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("event_id") @ExcludeMissing fun _eventId() = eventId @JsonProperty("invoice_id") @ExcludeMissing fun _invoiceId() = invoiceId + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1272,22 +1272,22 @@ private constructor( fun validate(): DecrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - priceId() + ledgerSequenceNumber() + metadata().validate() + startingBalance() eventId() invoiceId() + priceId() validated = true } } @@ -1301,85 +1301,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var priceId: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var eventId: JsonField = JsonMissing.of() private var invoiceId: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - metadata = decrementLedgerEntry.metadata id = decrementLedgerEntry.id - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - entryStatus = decrementLedgerEntry.entryStatus - customer = decrementLedgerEntry.customer - startingBalance = decrementLedgerEntry.startingBalance - endingBalance = decrementLedgerEntry.endingBalance amount = decrementLedgerEntry.amount - currency = decrementLedgerEntry.currency createdAt = decrementLedgerEntry.createdAt - description = decrementLedgerEntry.description creditBlock = decrementLedgerEntry.creditBlock + currency = decrementLedgerEntry.currency + customer = decrementLedgerEntry.customer + description = decrementLedgerEntry.description + endingBalance = decrementLedgerEntry.endingBalance + entryStatus = decrementLedgerEntry.entryStatus entryType = decrementLedgerEntry.entryType - priceId = decrementLedgerEntry.priceId + ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber + metadata = decrementLedgerEntry.metadata + startingBalance = decrementLedgerEntry.startingBalance eventId = decrementLedgerEntry.eventId invoiceId = decrementLedgerEntry.invoiceId + priceId = decrementLedgerEntry.priceId additionalProperties = decrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -1388,39 +1380,43 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 priceId(priceId: String) = priceId(JsonField.of(priceId)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun eventId(eventId: String) = eventId(JsonField.of(eventId)) @@ -1430,6 +1426,10 @@ private constructor( fun invoiceId(invoiceId: JsonField) = apply { this.invoiceId = invoiceId } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1451,22 +1451,22 @@ private constructor( fun build(): DecrementLedgerEntry = DecrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - priceId, + ledgerSequenceNumber, + metadata, + startingBalance, eventId, invoiceId, + priceId, additionalProperties.toImmutable(), ) } @@ -1921,140 +1921,140 @@ private constructor( return true } - return /* spotless:off */ other is DecrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && priceId == other.priceId && eventId == other.eventId && invoiceId == other.invoiceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is DecrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && eventId == other.eventId && invoiceId == other.invoiceId && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, priceId, eventId, invoiceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, eventId, invoiceId, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "DecrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, priceId=$priceId, eventId=$eventId, invoiceId=$invoiceId, additionalProperties=$additionalProperties}" + "DecrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, eventId=$eventId, invoiceId=$invoiceId, priceId=$priceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class ExpirationChangeLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") - fun newBlockExpiryDate(): Optional = - Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): Optional = + Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2063,20 +2063,20 @@ private constructor( fun validate(): ExpirationChangeLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() + startingBalance() validated = true } } @@ -2090,82 +2090,74 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - metadata = expirationChangeLedgerEntry.metadata id = expirationChangeLedgerEntry.id - ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber - entryStatus = expirationChangeLedgerEntry.entryStatus - customer = expirationChangeLedgerEntry.customer - startingBalance = expirationChangeLedgerEntry.startingBalance - endingBalance = expirationChangeLedgerEntry.endingBalance amount = expirationChangeLedgerEntry.amount - currency = expirationChangeLedgerEntry.currency createdAt = expirationChangeLedgerEntry.createdAt - description = expirationChangeLedgerEntry.description creditBlock = expirationChangeLedgerEntry.creditBlock + currency = expirationChangeLedgerEntry.currency + customer = expirationChangeLedgerEntry.customer + description = expirationChangeLedgerEntry.description + endingBalance = expirationChangeLedgerEntry.endingBalance + entryStatus = expirationChangeLedgerEntry.entryStatus entryType = expirationChangeLedgerEntry.entryType + ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber + metadata = expirationChangeLedgerEntry.metadata newBlockExpiryDate = expirationChangeLedgerEntry.newBlockExpiryDate + startingBalance = expirationChangeLedgerEntry.startingBalance additionalProperties = expirationChangeLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2174,35 +2166,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -2211,6 +2204,13 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) + + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2232,20 +2232,20 @@ private constructor( fun build(): ExpirationChangeLedgerEntry = ExpirationChangeLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, + startingBalance, additionalProperties.toImmutable(), ) } @@ -2700,129 +2700,129 @@ private constructor( return true } - return /* spotless:off */ other is ExpirationChangeLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ExpirationChangeLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ExpirationChangeLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, additionalProperties=$additionalProperties}" + "ExpirationChangeLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class CreditBlockExpiryLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -2832,19 +2832,19 @@ private constructor( fun validate(): CreditBlockExpiryLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -2858,80 +2858,72 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - metadata = creditBlockExpiryLedgerEntry.metadata id = creditBlockExpiryLedgerEntry.id - ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber - entryStatus = creditBlockExpiryLedgerEntry.entryStatus - customer = creditBlockExpiryLedgerEntry.customer - startingBalance = creditBlockExpiryLedgerEntry.startingBalance - endingBalance = creditBlockExpiryLedgerEntry.endingBalance amount = creditBlockExpiryLedgerEntry.amount - currency = creditBlockExpiryLedgerEntry.currency createdAt = creditBlockExpiryLedgerEntry.createdAt - description = creditBlockExpiryLedgerEntry.description creditBlock = creditBlockExpiryLedgerEntry.creditBlock + currency = creditBlockExpiryLedgerEntry.currency + customer = creditBlockExpiryLedgerEntry.customer + description = creditBlockExpiryLedgerEntry.description + endingBalance = creditBlockExpiryLedgerEntry.endingBalance + entryStatus = creditBlockExpiryLedgerEntry.entryStatus entryType = creditBlockExpiryLedgerEntry.entryType + ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber + metadata = creditBlockExpiryLedgerEntry.metadata + startingBalance = creditBlockExpiryLedgerEntry.startingBalance additionalProperties = creditBlockExpiryLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2940,36 +2932,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2991,19 +2991,19 @@ private constructor( fun build(): CreditBlockExpiryLedgerEntry = CreditBlockExpiryLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -3458,145 +3458,145 @@ private constructor( return true } - return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditBlockExpiryLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "CreditBlockExpiryLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3605,21 +3605,21 @@ private constructor( fun validate(): VoidLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - voidReason() + ledgerSequenceNumber() + metadata().validate() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -3633,83 +3633,75 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - metadata = voidLedgerEntry.metadata id = voidLedgerEntry.id - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - entryStatus = voidLedgerEntry.entryStatus - customer = voidLedgerEntry.customer - startingBalance = voidLedgerEntry.startingBalance - endingBalance = voidLedgerEntry.endingBalance amount = voidLedgerEntry.amount - currency = voidLedgerEntry.currency createdAt = voidLedgerEntry.createdAt - description = voidLedgerEntry.description creditBlock = voidLedgerEntry.creditBlock + currency = voidLedgerEntry.currency + customer = voidLedgerEntry.customer + description = voidLedgerEntry.description + endingBalance = voidLedgerEntry.endingBalance + entryStatus = voidLedgerEntry.entryStatus entryType = voidLedgerEntry.entryType - voidReason = voidLedgerEntry.voidReason + ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber + metadata = voidLedgerEntry.metadata + startingBalance = voidLedgerEntry.startingBalance voidAmount = voidLedgerEntry.voidAmount + voidReason = voidLedgerEntry.voidReason additionalProperties = voidLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -3718,44 +3710,52 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } - fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - - fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3777,21 +3777,21 @@ private constructor( fun build(): VoidLedgerEntry = VoidLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - voidReason, + ledgerSequenceNumber, + metadata, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -4246,155 +4246,155 @@ private constructor( return true } - return /* spotless:off */ other is VoidLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidInitiatedLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("starting_balance") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun newBlockExpiryDate(): OffsetDateTime = - newBlockExpiryDate.getRequired("new_block_expiry_date") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): OffsetDateTime = + newBlockExpiryDate.getRequired("new_block_expiry_date") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4403,22 +4403,22 @@ private constructor( fun validate(): VoidInitiatedLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() - voidReason() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -4432,85 +4432,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - metadata = voidInitiatedLedgerEntry.metadata id = voidInitiatedLedgerEntry.id - ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber - entryStatus = voidInitiatedLedgerEntry.entryStatus - customer = voidInitiatedLedgerEntry.customer - startingBalance = voidInitiatedLedgerEntry.startingBalance - endingBalance = voidInitiatedLedgerEntry.endingBalance amount = voidInitiatedLedgerEntry.amount - currency = voidInitiatedLedgerEntry.currency createdAt = voidInitiatedLedgerEntry.createdAt - description = voidInitiatedLedgerEntry.description creditBlock = voidInitiatedLedgerEntry.creditBlock + currency = voidInitiatedLedgerEntry.currency + customer = voidInitiatedLedgerEntry.customer + description = voidInitiatedLedgerEntry.description + endingBalance = voidInitiatedLedgerEntry.endingBalance + entryStatus = voidInitiatedLedgerEntry.entryStatus entryType = voidInitiatedLedgerEntry.entryType + ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber + metadata = voidInitiatedLedgerEntry.metadata newBlockExpiryDate = voidInitiatedLedgerEntry.newBlockExpiryDate - voidReason = voidInitiatedLedgerEntry.voidReason + startingBalance = voidInitiatedLedgerEntry.startingBalance voidAmount = voidInitiatedLedgerEntry.voidAmount + voidReason = voidInitiatedLedgerEntry.voidReason additionalProperties = voidInitiatedLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -4519,35 +4511,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -4556,14 +4549,21 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } - fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } + fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + + fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4585,22 +4585,22 @@ private constructor( fun build(): VoidInitiatedLedgerEntry = VoidInitiatedLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, - voidReason, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -5055,129 +5055,129 @@ private constructor( return true } - return /* spotless:off */ other is VoidInitiatedLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidInitiatedLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidInitiatedLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidInitiatedLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class AmendmentLedgerEntry @JsonCreator - private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -5187,19 +5187,19 @@ private constructor( fun validate(): AmendmentLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -5213,79 +5213,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - metadata = amendmentLedgerEntry.metadata id = amendmentLedgerEntry.id - ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber - entryStatus = amendmentLedgerEntry.entryStatus - customer = amendmentLedgerEntry.customer - startingBalance = amendmentLedgerEntry.startingBalance - endingBalance = amendmentLedgerEntry.endingBalance amount = amendmentLedgerEntry.amount - currency = amendmentLedgerEntry.currency createdAt = amendmentLedgerEntry.createdAt - description = amendmentLedgerEntry.description creditBlock = amendmentLedgerEntry.creditBlock + currency = amendmentLedgerEntry.currency + customer = amendmentLedgerEntry.customer + description = amendmentLedgerEntry.description + endingBalance = amendmentLedgerEntry.endingBalance + entryStatus = amendmentLedgerEntry.entryStatus entryType = amendmentLedgerEntry.entryType + ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber + metadata = amendmentLedgerEntry.metadata + startingBalance = amendmentLedgerEntry.startingBalance additionalProperties = amendmentLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -5294,36 +5286,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5345,19 +5345,19 @@ private constructor( fun build(): AmendmentLedgerEntry = AmendmentLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -5812,16 +5812,16 @@ private constructor( return true } - return /* spotless:off */ other is AmendmentLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmendmentLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmendmentLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "AmendmentLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt index 2767233e..23109e67 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt @@ -595,25 +595,26 @@ constructor( class AddIncrementCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("amount") private val amount: Double, + @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("currency") private val currency: String?, @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("amount") private val amount: Double, - @JsonProperty("expiry_date") private val expiryDate: OffsetDateTime?, @JsonProperty("effective_date") private val effectiveDate: OffsetDateTime?, - @JsonProperty("per_unit_cost_basis") private val perUnitCostBasis: String?, + @JsonProperty("expiry_date") private val expiryDate: OffsetDateTime?, @JsonProperty("invoice_settings") private val invoiceSettings: InvoiceSettings?, + @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("per_unit_cost_basis") private val perUnitCostBasis: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -629,24 +630,31 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * An ISO 8601 format date that denotes when this credit balance should become available for + * use. */ - @JsonProperty("amount") fun amount(): Double = amount + @JsonProperty("effective_date") + fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) /** An ISO 8601 format date that denotes when this credit balance should expire. */ @JsonProperty("expiry_date") fun expiryDate(): Optional = Optional.ofNullable(expiryDate) /** - * An ISO 8601 format date that denotes when this credit balance should become available for - * use. + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the + * calculation of the invoice total is done on that basis. */ - @JsonProperty("effective_date") - fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) + @JsonProperty("invoice_settings") + fun invoiceSettings(): Optional = Optional.ofNullable(invoiceSettings) + + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) /** * Can only be specified when entry_type=increment. How much, in the customer's currency, a @@ -655,14 +663,6 @@ constructor( @JsonProperty("per_unit_cost_basis") fun perUnitCostBasis(): Optional = Optional.ofNullable(perUnitCostBasis) - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the - * calculation of the invoice total is done on that basis. - */ - @JsonProperty("invoice_settings") - fun invoiceSettings(): Optional = Optional.ofNullable(invoiceSettings) - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -676,15 +676,15 @@ constructor( class Builder { - private var metadata: Metadata? = null + private var amount: Double? = null + private var entryType: EntryType? = null private var currency: String? = null private var description: String? = null - private var entryType: EntryType? = null - private var amount: Double? = null - private var expiryDate: OffsetDateTime? = null private var effectiveDate: OffsetDateTime? = null - private var perUnitCostBasis: String? = null + private var expiryDate: OffsetDateTime? = null private var invoiceSettings: InvoiceSettings? = null + private var metadata: Metadata? = null + private var perUnitCostBasis: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -692,75 +692,121 @@ constructor( addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams ) = apply { - metadata = addIncrementCreditLedgerEntryRequestParams.metadata + amount = addIncrementCreditLedgerEntryRequestParams.amount + entryType = addIncrementCreditLedgerEntryRequestParams.entryType currency = addIncrementCreditLedgerEntryRequestParams.currency description = addIncrementCreditLedgerEntryRequestParams.description - entryType = addIncrementCreditLedgerEntryRequestParams.entryType - amount = addIncrementCreditLedgerEntryRequestParams.amount - expiryDate = addIncrementCreditLedgerEntryRequestParams.expiryDate effectiveDate = addIncrementCreditLedgerEntryRequestParams.effectiveDate - perUnitCostBasis = addIncrementCreditLedgerEntryRequestParams.perUnitCostBasis + expiryDate = addIncrementCreditLedgerEntryRequestParams.expiryDate invoiceSettings = addIncrementCreditLedgerEntryRequestParams.invoiceSettings + metadata = addIncrementCreditLedgerEntryRequestParams.metadata + perUnitCostBasis = addIncrementCreditLedgerEntryRequestParams.perUnitCostBasis additionalProperties = addIncrementCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(amount: Double) = apply { this.amount = amount } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun currency(currency: String?) = apply { this.currency = currency } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } - - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun description(description: String?) = apply { this.description = description } /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. */ - fun amount(amount: Double) = apply { this.amount = amount } - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: OffsetDateTime) = apply { this.expiryDate = expiryDate } + fun description(description: Optional) = description(description.orElse(null)) /** * An ISO 8601 format date that denotes when this credit balance should become available * for use. */ - fun effectiveDate(effectiveDate: OffsetDateTime) = apply { + fun effectiveDate(effectiveDate: OffsetDateTime?) = apply { this.effectiveDate = effectiveDate } /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block + * An ISO 8601 format date that denotes when this credit balance should become available + * for use. */ - fun perUnitCostBasis(perUnitCostBasis: String) = apply { - this.perUnitCostBasis = perUnitCostBasis - } + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) + + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: OffsetDateTime?) = apply { this.expiryDate = expiryDate } + + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) /** * Passing `invoice_settings` automatically generates an invoice for the newly added * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as * the calculation of the invoice total is done on that basis. */ - fun invoiceSettings(invoiceSettings: InvoiceSettings) = apply { + fun invoiceSettings(invoiceSettings: InvoiceSettings?) = apply { this.invoiceSettings = invoiceSettings } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as + * the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(invoiceSettings: Optional) = + invoiceSettings(invoiceSettings.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: String?) = apply { + this.perUnitCostBasis = perUnitCostBasis + } + + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: Optional) = + perUnitCostBasis(perUnitCostBasis.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -782,15 +828,15 @@ constructor( fun build(): AddIncrementCreditLedgerEntryRequestParams = AddIncrementCreditLedgerEntryRequestParams( - metadata, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, currency, description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, - expiryDate, effectiveDate, - perUnitCostBasis, + expiryDate, invoiceSettings, + metadata, + perUnitCostBasis, additionalProperties.toImmutable(), ) } @@ -931,16 +977,34 @@ constructor( fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } /** An optional memo to display on the invoice. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String?) = apply { this.memo = memo } + + /** An optional memo to display on the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) /** * If true, the new credit block will require that the corresponding invoice is paid * before it can be drawn down from. */ - fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = apply { + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean?) = apply { this.requireSuccessfulPayment = requireSuccessfulPayment } + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = + requireSuccessfulPayment(requireSuccessfulPayment as Boolean?) + + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun requireSuccessfulPayment(requireSuccessfulPayment: Optional) = + requireSuccessfulPayment(requireSuccessfulPayment.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1073,38 +1137,39 @@ constructor( return true } - return /* spotless:off */ other is AddIncrementCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && expiryDate == other.expiryDate && effectiveDate == other.effectiveDate && perUnitCostBasis == other.perUnitCostBasis && invoiceSettings == other.invoiceSettings && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddIncrementCreditLedgerEntryRequestParams && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && invoiceSettings == other.invoiceSettings && metadata == other.metadata && perUnitCostBasis == other.perUnitCostBasis && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, expiryDate, effectiveDate, perUnitCostBasis, invoiceSettings, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, effectiveDate, expiryDate, invoiceSettings, metadata, perUnitCostBasis, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddIncrementCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, expiryDate=$expiryDate, effectiveDate=$effectiveDate, perUnitCostBasis=$perUnitCostBasis, invoiceSettings=$invoiceSettings, additionalProperties=$additionalProperties}" + "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddDecrementCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("amount") private val amount: Double, + @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("currency") private val currency: String?, @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("amount") private val amount: Double, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -1120,13 +1185,12 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * User-specified key/value pairs for the resource. 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("amount") fun amount(): Double = amount + @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -1141,11 +1205,11 @@ constructor( class Builder { - private var metadata: Metadata? = null + private var amount: Double? = null + private var entryType: EntryType? = null private var currency: String? = null private var description: String? = null - private var entryType: EntryType? = null - private var amount: Double? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1153,42 +1217,62 @@ constructor( addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams ) = apply { - metadata = addDecrementCreditLedgerEntryRequestParams.metadata + amount = addDecrementCreditLedgerEntryRequestParams.amount + entryType = addDecrementCreditLedgerEntryRequestParams.entryType currency = addDecrementCreditLedgerEntryRequestParams.currency description = addDecrementCreditLedgerEntryRequestParams.description - entryType = addDecrementCreditLedgerEntryRequestParams.entryType - amount = addDecrementCreditLedgerEntryRequestParams.amount + metadata = addDecrementCreditLedgerEntryRequestParams.metadata additionalProperties = addDecrementCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(amount: Double) = apply { this.amount = amount } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun currency(currency: String?) = apply { this.currency = currency } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * User-specified key/value pairs for the resource. 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 amount(amount: Double) = apply { this.amount = amount } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1211,11 +1295,11 @@ constructor( fun build(): AddDecrementCreditLedgerEntryRequestParams = AddDecrementCreditLedgerEntryRequestParams( - metadata, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, currency, description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -1351,57 +1435,46 @@ constructor( return true } - return /* spotless:off */ other is AddDecrementCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddDecrementCreditLedgerEntryRequestParams && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddDecrementCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, additionalProperties=$additionalProperties}" + "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddExpirationChangeCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("currency") private val currency: String?, - @JsonProperty("description") private val description: String?, @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("amount") private val amount: Double?, @JsonProperty("expiry_date") private val expiryDate: OffsetDateTime?, - @JsonProperty("block_id") private val blockId: String?, @JsonProperty("target_expiry_date") private val targetExpiryDate: LocalDate, + @JsonProperty("amount") private val amount: Double?, + @JsonProperty("block_id") private val blockId: String?, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("description") private val description: String?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("entry_type") fun entryType(): EntryType = entryType + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + @JsonProperty("expiry_date") + fun expiryDate(): Optional = Optional.ofNullable(expiryDate) + /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when + * credits transferred (as part of a partial block expiration) should expire. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") fun currency(): Optional = Optional.ofNullable(currency) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - fun description(): Optional = Optional.ofNullable(description) - - @JsonProperty("entry_type") fun entryType(): EntryType = entryType + @JsonProperty("target_expiry_date") fun targetExpiryDate(): LocalDate = targetExpiryDate /** * The number of credits to effect. Note that this is required for increment, decrement, @@ -1409,10 +1482,6 @@ constructor( */ @JsonProperty("amount") fun amount(): Optional = Optional.ofNullable(amount) - /** An ISO 8601 format date that identifies the origination credit block to expire */ - @JsonProperty("expiry_date") - fun expiryDate(): Optional = Optional.ofNullable(expiryDate) - /** * The ID of the block affected by an expiration_change, used to differentiate between * multiple blocks with the same `expiry_date`. @@ -1420,10 +1489,25 @@ constructor( @JsonProperty("block_id") fun blockId(): Optional = Optional.ofNullable(blockId) /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when - * credits transferred (as part of a partial block expiration) should expire. + * The currency or custom pricing unit to use for this ledger entry. If this is a real-world + * currency, it must match the customer's invoicing currency. */ - @JsonProperty("target_expiry_date") fun targetExpiryDate(): LocalDate = targetExpiryDate + @JsonProperty("currency") fun currency(): Optional = Optional.ofNullable(currency) + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + fun description(): Optional = Optional.ofNullable(description) + + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -1438,14 +1522,14 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var currency: String? = null - private var description: String? = null private var entryType: EntryType? = null - private var amount: Double? = null private var expiryDate: OffsetDateTime? = null - private var blockId: String? = null private var targetExpiryDate: LocalDate? = null + private var amount: Double? = null + private var blockId: String? = null + private var currency: String? = null + private var description: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1453,64 +1537,107 @@ constructor( addExpirationChangeCreditLedgerEntryRequestParams: AddExpirationChangeCreditLedgerEntryRequestParams ) = apply { - metadata = addExpirationChangeCreditLedgerEntryRequestParams.metadata - currency = addExpirationChangeCreditLedgerEntryRequestParams.currency - description = addExpirationChangeCreditLedgerEntryRequestParams.description entryType = addExpirationChangeCreditLedgerEntryRequestParams.entryType - amount = addExpirationChangeCreditLedgerEntryRequestParams.amount expiryDate = addExpirationChangeCreditLedgerEntryRequestParams.expiryDate - blockId = addExpirationChangeCreditLedgerEntryRequestParams.blockId targetExpiryDate = addExpirationChangeCreditLedgerEntryRequestParams.targetExpiryDate + amount = addExpirationChangeCreditLedgerEntryRequestParams.amount + blockId = addExpirationChangeCreditLedgerEntryRequestParams.blockId + currency = addExpirationChangeCreditLedgerEntryRequestParams.currency + description = addExpirationChangeCreditLedgerEntryRequestParams.description + metadata = addExpirationChangeCreditLedgerEntryRequestParams.metadata additionalProperties = addExpirationChangeCreditLedgerEntryRequestParams.additionalProperties .toMutableMap() } + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + fun expiryDate(expiryDate: OffsetDateTime?) = apply { this.expiryDate = expiryDate } + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) + /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting + * when credits transferred (as part of a partial block expiration) should expire. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun targetExpiryDate(targetExpiryDate: LocalDate) = apply { + this.targetExpiryDate = targetExpiryDate + } /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun currency(currency: String) = apply { this.currency = currency } + fun amount(amount: Double?) = apply { this.amount = amount } /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun description(description: String) = apply { this.description = description } - - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun amount(amount: Double) = amount(amount as Double?) /** * The number of credits to effect. Note that this is required for increment, decrement, * void, or undo operations. */ - fun amount(amount: Double) = apply { this.amount = amount } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Double?) - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: OffsetDateTime) = apply { this.expiryDate = expiryDate } + /** + * The ID of the block affected by an expiration_change, used to differentiate between + * multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: String?) = apply { this.blockId = blockId } /** * The ID of the block affected by an expiration_change, used to differentiate between * multiple blocks with the same `expiry_date`. */ - fun blockId(blockId: String) = apply { this.blockId = blockId } + fun blockId(blockId: Optional) = blockId(blockId.orElse(null)) /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting - * when credits transferred (as part of a partial block expiration) should expire. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun targetExpiryDate(targetExpiryDate: LocalDate) = apply { - this.targetExpiryDate = targetExpiryDate - } + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: String?) = apply { this.description = description } + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1533,16 +1660,16 @@ constructor( fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = AddExpirationChangeCreditLedgerEntryRequestParams( - metadata, - currency, - description, checkNotNull(entryType) { "`entryType` is required but was not set" }, - amount, expiryDate, - blockId, checkNotNull(targetExpiryDate) { "`targetExpiryDate` is required but was not set" }, + amount, + blockId, + currency, + description, + metadata, additionalProperties.toImmutable(), ) } @@ -1678,40 +1805,44 @@ constructor( return true } - return /* spotless:off */ other is AddExpirationChangeCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && expiryDate == other.expiryDate && blockId == other.blockId && targetExpiryDate == other.targetExpiryDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddExpirationChangeCreditLedgerEntryRequestParams && entryType == other.entryType && expiryDate == other.expiryDate && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, expiryDate, blockId, targetExpiryDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddExpirationChangeCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, expiryDate=$expiryDate, blockId=$blockId, targetExpiryDate=$targetExpiryDate, additionalProperties=$additionalProperties}" + "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddVoidCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, + @JsonProperty("amount") private val amount: Double, + @JsonProperty("block_id") private val blockId: String, + @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("currency") private val currency: String?, @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, - @JsonProperty("block_id") private val blockId: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("void_reason") private val voidReason: VoidReason?, - @JsonProperty("amount") private val amount: Double, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + /** The ID of the block to void. */ + @JsonProperty("block_id") fun blockId(): String = blockId + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -1727,21 +1858,17 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - - /** The ID of the block to void. */ - @JsonProperty("block_id") fun blockId(): String = blockId + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) /** Can only be specified when `entry_type=void`. The reason for the void. */ @JsonProperty("void_reason") fun voidReason(): Optional = Optional.ofNullable(voidReason) - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") fun amount(): Double = amount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1755,63 +1882,86 @@ constructor( class Builder { - private var metadata: Metadata? = null + private var amount: Double? = null + private var blockId: String? = null + private var entryType: EntryType? = null private var currency: String? = null private var description: String? = null - private var entryType: EntryType? = null - private var blockId: String? = null + private var metadata: Metadata? = null private var voidReason: VoidReason? = null - private var amount: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams ) = apply { - metadata = addVoidCreditLedgerEntryRequestParams.metadata + amount = addVoidCreditLedgerEntryRequestParams.amount + blockId = addVoidCreditLedgerEntryRequestParams.blockId + entryType = addVoidCreditLedgerEntryRequestParams.entryType currency = addVoidCreditLedgerEntryRequestParams.currency description = addVoidCreditLedgerEntryRequestParams.description - entryType = addVoidCreditLedgerEntryRequestParams.entryType - blockId = addVoidCreditLedgerEntryRequestParams.blockId + metadata = addVoidCreditLedgerEntryRequestParams.metadata voidReason = addVoidCreditLedgerEntryRequestParams.voidReason - amount = addVoidCreditLedgerEntryRequestParams.amount additionalProperties = addVoidCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(amount: Double) = apply { this.amount = amount } + + /** The ID of the block to void. */ + fun blockId(blockId: String) = apply { this.blockId = blockId } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun currency(currency: String?) = apply { this.currency = currency } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } - - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun description(description: String?) = apply { this.description = description } - /** The ID of the block to void. */ - fun blockId(blockId: String) = apply { this.blockId = blockId } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: VoidReason) = apply { this.voidReason = voidReason } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * User-specified key/value pairs for the resource. 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 amount(amount: Double) = apply { this.amount = amount } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: VoidReason?) = apply { this.voidReason = voidReason } + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: Optional) = voidReason(voidReason.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1834,13 +1984,13 @@ constructor( fun build(): AddVoidCreditLedgerEntryRequestParams = AddVoidCreditLedgerEntryRequestParams( - metadata, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(blockId) { "`blockId` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, currency, description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, - checkNotNull(blockId) { "`blockId` is required but was not set" }, + metadata, voidReason, - checkNotNull(amount) { "`amount` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -2027,39 +2177,43 @@ constructor( return true } - return /* spotless:off */ other is AddVoidCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && blockId == other.blockId && voidReason == other.voidReason && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddVoidCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, blockId, voidReason, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddVoidCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, blockId=$blockId, voidReason=$voidReason, amount=$amount, additionalProperties=$additionalProperties}" + "AddVoidCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddAmendmentCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("currency") private val currency: String?, - @JsonProperty("description") private val description: String?, - @JsonProperty("entry_type") private val entryType: EntryType, @JsonProperty("amount") private val amount: Double, @JsonProperty("block_id") private val blockId: String, + @JsonProperty("entry_type") private val entryType: EntryType, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("description") private val description: String?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement or + * void operations. */ - @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("amount") fun amount(): Double = amount + + /** The ID of the block to reverse a decrement from. */ + @JsonProperty("block_id") fun blockId(): String = blockId + + @JsonProperty("entry_type") fun entryType(): EntryType = entryType /** * The currency or custom pricing unit to use for this ledger entry. If this is a real-world @@ -2075,16 +2229,12 @@ constructor( @JsonProperty("description") fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("entry_type") fun entryType(): EntryType = entryType - /** - * The number of credits to effect. Note that this is required for increment, decrement or - * void operations. + * User-specified key/value pairs for the resource. 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("amount") fun amount(): Double = amount - - /** The ID of the block to reverse a decrement from. */ - @JsonProperty("block_id") fun blockId(): String = blockId + @JsonProperty("metadata") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -2099,12 +2249,12 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var currency: String? = null - private var description: String? = null - private var entryType: EntryType? = null private var amount: Double? = null private var blockId: String? = null + private var entryType: EntryType? = null + private var currency: String? = null + private var description: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2112,46 +2262,66 @@ constructor( addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams ) = apply { - metadata = addAmendmentCreditLedgerEntryRequestParams.metadata - currency = addAmendmentCreditLedgerEntryRequestParams.currency - description = addAmendmentCreditLedgerEntryRequestParams.description - entryType = addAmendmentCreditLedgerEntryRequestParams.entryType amount = addAmendmentCreditLedgerEntryRequestParams.amount blockId = addAmendmentCreditLedgerEntryRequestParams.blockId + entryType = addAmendmentCreditLedgerEntryRequestParams.entryType + currency = addAmendmentCreditLedgerEntryRequestParams.currency + description = addAmendmentCreditLedgerEntryRequestParams.description + metadata = addAmendmentCreditLedgerEntryRequestParams.metadata additionalProperties = addAmendmentCreditLedgerEntryRequestParams.additionalProperties.toMutableMap() } /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement + * or void operations. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun amount(amount: Double) = apply { this.amount = amount } + + /** The ID of the block to reverse a decrement from. */ + fun blockId(blockId: String) = apply { this.blockId = blockId } + + fun entryType(entryType: EntryType) = apply { this.entryType = entryType } /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(description: Optional) = description(description.orElse(null)) /** - * The number of credits to effect. Note that this is required for increment, decrement - * or void operations. + * User-specified key/value pairs for the resource. 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 amount(amount: Double) = apply { this.amount = amount } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** The ID of the block to reverse a decrement from. */ - fun blockId(blockId: String) = apply { this.blockId = blockId } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2174,12 +2344,12 @@ constructor( fun build(): AddAmendmentCreditLedgerEntryRequestParams = AddAmendmentCreditLedgerEntryRequestParams( - metadata, - currency, - description, - checkNotNull(entryType) { "`entryType` is required but was not set" }, checkNotNull(amount) { "`amount` is required but was not set" }, checkNotNull(blockId) { "`blockId` is required but was not set" }, + checkNotNull(entryType) { "`entryType` is required but was not set" }, + currency, + description, + metadata, additionalProperties.toImmutable(), ) } @@ -2315,17 +2485,17 @@ constructor( return true } - return /* spotless:off */ other is AddAmendmentCreditLedgerEntryRequestParams && metadata == other.metadata && currency == other.currency && description == other.description && entryType == other.entryType && amount == other.amount && blockId == other.blockId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddAmendmentCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, currency, description, entryType, amount, blockId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddAmendmentCreditLedgerEntryRequestParams{metadata=$metadata, currency=$currency, description=$description, entryType=$entryType, amount=$amount, blockId=$blockId, additionalProperties=$additionalProperties}" + "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt index e1d1307d..2ff60595 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt @@ -366,112 +366,112 @@ private constructor( class IncrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -481,19 +481,19 @@ private constructor( fun validate(): IncrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -507,79 +507,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - metadata = incrementLedgerEntry.metadata id = incrementLedgerEntry.id - ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber - entryStatus = incrementLedgerEntry.entryStatus - customer = incrementLedgerEntry.customer - startingBalance = incrementLedgerEntry.startingBalance - endingBalance = incrementLedgerEntry.endingBalance amount = incrementLedgerEntry.amount - currency = incrementLedgerEntry.currency createdAt = incrementLedgerEntry.createdAt - description = incrementLedgerEntry.description creditBlock = incrementLedgerEntry.creditBlock + currency = incrementLedgerEntry.currency + customer = incrementLedgerEntry.customer + description = incrementLedgerEntry.description + endingBalance = incrementLedgerEntry.endingBalance + entryStatus = incrementLedgerEntry.entryStatus entryType = incrementLedgerEntry.entryType + ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber + metadata = incrementLedgerEntry.metadata + startingBalance = incrementLedgerEntry.startingBalance additionalProperties = incrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -588,36 +580,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -639,19 +639,19 @@ private constructor( fun build(): IncrementLedgerEntry = IncrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -1106,151 +1106,151 @@ private constructor( return true } - return /* spotless:off */ other is IncrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IncrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IncrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "IncrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class DecrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("price_id") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("event_id") @ExcludeMissing private val eventId: JsonField = JsonMissing.of(), @JsonProperty("invoice_id") @ExcludeMissing private val invoiceId: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + /** + * 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("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("event_id") @ExcludeMissing fun _eventId() = eventId @JsonProperty("invoice_id") @ExcludeMissing fun _invoiceId() = invoiceId + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1259,22 +1259,22 @@ private constructor( fun validate(): DecrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - priceId() + ledgerSequenceNumber() + metadata().validate() + startingBalance() eventId() invoiceId() + priceId() validated = true } } @@ -1288,85 +1288,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var priceId: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var eventId: JsonField = JsonMissing.of() private var invoiceId: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - metadata = decrementLedgerEntry.metadata id = decrementLedgerEntry.id - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - entryStatus = decrementLedgerEntry.entryStatus - customer = decrementLedgerEntry.customer - startingBalance = decrementLedgerEntry.startingBalance - endingBalance = decrementLedgerEntry.endingBalance amount = decrementLedgerEntry.amount - currency = decrementLedgerEntry.currency createdAt = decrementLedgerEntry.createdAt - description = decrementLedgerEntry.description creditBlock = decrementLedgerEntry.creditBlock + currency = decrementLedgerEntry.currency + customer = decrementLedgerEntry.customer + description = decrementLedgerEntry.description + endingBalance = decrementLedgerEntry.endingBalance + entryStatus = decrementLedgerEntry.entryStatus entryType = decrementLedgerEntry.entryType - priceId = decrementLedgerEntry.priceId + ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber + metadata = decrementLedgerEntry.metadata + startingBalance = decrementLedgerEntry.startingBalance eventId = decrementLedgerEntry.eventId invoiceId = decrementLedgerEntry.invoiceId + priceId = decrementLedgerEntry.priceId additionalProperties = decrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -1375,39 +1367,43 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 priceId(priceId: String) = priceId(JsonField.of(priceId)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun eventId(eventId: String) = eventId(JsonField.of(eventId)) @@ -1417,6 +1413,10 @@ private constructor( fun invoiceId(invoiceId: JsonField) = apply { this.invoiceId = invoiceId } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1438,22 +1438,22 @@ private constructor( fun build(): DecrementLedgerEntry = DecrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - priceId, + ledgerSequenceNumber, + metadata, + startingBalance, eventId, invoiceId, + priceId, additionalProperties.toImmutable(), ) } @@ -1908,140 +1908,140 @@ private constructor( return true } - return /* spotless:off */ other is DecrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && priceId == other.priceId && eventId == other.eventId && invoiceId == other.invoiceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is DecrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && eventId == other.eventId && invoiceId == other.invoiceId && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, priceId, eventId, invoiceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, eventId, invoiceId, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "DecrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, priceId=$priceId, eventId=$eventId, invoiceId=$invoiceId, additionalProperties=$additionalProperties}" + "DecrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, eventId=$eventId, invoiceId=$invoiceId, priceId=$priceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class ExpirationChangeLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") - fun newBlockExpiryDate(): Optional = - Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): Optional = + Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2050,20 +2050,20 @@ private constructor( fun validate(): ExpirationChangeLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() + startingBalance() validated = true } } @@ -2077,82 +2077,74 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - metadata = expirationChangeLedgerEntry.metadata id = expirationChangeLedgerEntry.id - ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber - entryStatus = expirationChangeLedgerEntry.entryStatus - customer = expirationChangeLedgerEntry.customer - startingBalance = expirationChangeLedgerEntry.startingBalance - endingBalance = expirationChangeLedgerEntry.endingBalance amount = expirationChangeLedgerEntry.amount - currency = expirationChangeLedgerEntry.currency createdAt = expirationChangeLedgerEntry.createdAt - description = expirationChangeLedgerEntry.description creditBlock = expirationChangeLedgerEntry.creditBlock + currency = expirationChangeLedgerEntry.currency + customer = expirationChangeLedgerEntry.customer + description = expirationChangeLedgerEntry.description + endingBalance = expirationChangeLedgerEntry.endingBalance + entryStatus = expirationChangeLedgerEntry.entryStatus entryType = expirationChangeLedgerEntry.entryType + ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber + metadata = expirationChangeLedgerEntry.metadata newBlockExpiryDate = expirationChangeLedgerEntry.newBlockExpiryDate + startingBalance = expirationChangeLedgerEntry.startingBalance additionalProperties = expirationChangeLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2161,35 +2153,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -2198,6 +2191,13 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) + + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2219,20 +2219,20 @@ private constructor( fun build(): ExpirationChangeLedgerEntry = ExpirationChangeLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, + startingBalance, additionalProperties.toImmutable(), ) } @@ -2687,129 +2687,129 @@ private constructor( return true } - return /* spotless:off */ other is ExpirationChangeLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ExpirationChangeLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ExpirationChangeLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, additionalProperties=$additionalProperties}" + "ExpirationChangeLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class CreditBlockExpiryLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -2819,19 +2819,19 @@ private constructor( fun validate(): CreditBlockExpiryLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -2845,80 +2845,72 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - metadata = creditBlockExpiryLedgerEntry.metadata id = creditBlockExpiryLedgerEntry.id - ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber - entryStatus = creditBlockExpiryLedgerEntry.entryStatus - customer = creditBlockExpiryLedgerEntry.customer - startingBalance = creditBlockExpiryLedgerEntry.startingBalance - endingBalance = creditBlockExpiryLedgerEntry.endingBalance amount = creditBlockExpiryLedgerEntry.amount - currency = creditBlockExpiryLedgerEntry.currency createdAt = creditBlockExpiryLedgerEntry.createdAt - description = creditBlockExpiryLedgerEntry.description creditBlock = creditBlockExpiryLedgerEntry.creditBlock + currency = creditBlockExpiryLedgerEntry.currency + customer = creditBlockExpiryLedgerEntry.customer + description = creditBlockExpiryLedgerEntry.description + endingBalance = creditBlockExpiryLedgerEntry.endingBalance + entryStatus = creditBlockExpiryLedgerEntry.entryStatus entryType = creditBlockExpiryLedgerEntry.entryType + ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber + metadata = creditBlockExpiryLedgerEntry.metadata + startingBalance = creditBlockExpiryLedgerEntry.startingBalance additionalProperties = creditBlockExpiryLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2927,36 +2919,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2978,19 +2978,19 @@ private constructor( fun build(): CreditBlockExpiryLedgerEntry = CreditBlockExpiryLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -3445,145 +3445,145 @@ private constructor( return true } - return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditBlockExpiryLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "CreditBlockExpiryLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3592,21 +3592,21 @@ private constructor( fun validate(): VoidLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - voidReason() + ledgerSequenceNumber() + metadata().validate() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -3620,83 +3620,75 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - metadata = voidLedgerEntry.metadata id = voidLedgerEntry.id - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - entryStatus = voidLedgerEntry.entryStatus - customer = voidLedgerEntry.customer - startingBalance = voidLedgerEntry.startingBalance - endingBalance = voidLedgerEntry.endingBalance amount = voidLedgerEntry.amount - currency = voidLedgerEntry.currency createdAt = voidLedgerEntry.createdAt - description = voidLedgerEntry.description creditBlock = voidLedgerEntry.creditBlock + currency = voidLedgerEntry.currency + customer = voidLedgerEntry.customer + description = voidLedgerEntry.description + endingBalance = voidLedgerEntry.endingBalance + entryStatus = voidLedgerEntry.entryStatus entryType = voidLedgerEntry.entryType - voidReason = voidLedgerEntry.voidReason + ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber + metadata = voidLedgerEntry.metadata + startingBalance = voidLedgerEntry.startingBalance voidAmount = voidLedgerEntry.voidAmount + voidReason = voidLedgerEntry.voidReason additionalProperties = voidLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -3705,44 +3697,52 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } - fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - - fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3764,21 +3764,21 @@ private constructor( fun build(): VoidLedgerEntry = VoidLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - voidReason, + ledgerSequenceNumber, + metadata, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -4233,155 +4233,155 @@ private constructor( return true } - return /* spotless:off */ other is VoidLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidInitiatedLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("starting_balance") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun newBlockExpiryDate(): OffsetDateTime = - newBlockExpiryDate.getRequired("new_block_expiry_date") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): OffsetDateTime = + newBlockExpiryDate.getRequired("new_block_expiry_date") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4390,22 +4390,22 @@ private constructor( fun validate(): VoidInitiatedLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() - voidReason() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -4419,85 +4419,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - metadata = voidInitiatedLedgerEntry.metadata id = voidInitiatedLedgerEntry.id - ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber - entryStatus = voidInitiatedLedgerEntry.entryStatus - customer = voidInitiatedLedgerEntry.customer - startingBalance = voidInitiatedLedgerEntry.startingBalance - endingBalance = voidInitiatedLedgerEntry.endingBalance amount = voidInitiatedLedgerEntry.amount - currency = voidInitiatedLedgerEntry.currency createdAt = voidInitiatedLedgerEntry.createdAt - description = voidInitiatedLedgerEntry.description creditBlock = voidInitiatedLedgerEntry.creditBlock + currency = voidInitiatedLedgerEntry.currency + customer = voidInitiatedLedgerEntry.customer + description = voidInitiatedLedgerEntry.description + endingBalance = voidInitiatedLedgerEntry.endingBalance + entryStatus = voidInitiatedLedgerEntry.entryStatus entryType = voidInitiatedLedgerEntry.entryType + ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber + metadata = voidInitiatedLedgerEntry.metadata newBlockExpiryDate = voidInitiatedLedgerEntry.newBlockExpiryDate - voidReason = voidInitiatedLedgerEntry.voidReason + startingBalance = voidInitiatedLedgerEntry.startingBalance voidAmount = voidInitiatedLedgerEntry.voidAmount + voidReason = voidInitiatedLedgerEntry.voidReason additionalProperties = voidInitiatedLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -4506,35 +4498,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -4543,14 +4536,21 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } - fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } + fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + + fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4572,22 +4572,22 @@ private constructor( fun build(): VoidInitiatedLedgerEntry = VoidInitiatedLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, - voidReason, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -5042,129 +5042,129 @@ private constructor( return true } - return /* spotless:off */ other is VoidInitiatedLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidInitiatedLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidInitiatedLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidInitiatedLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class AmendmentLedgerEntry @JsonCreator - private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -5174,19 +5174,19 @@ private constructor( fun validate(): AmendmentLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -5200,79 +5200,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - metadata = amendmentLedgerEntry.metadata id = amendmentLedgerEntry.id - ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber - entryStatus = amendmentLedgerEntry.entryStatus - customer = amendmentLedgerEntry.customer - startingBalance = amendmentLedgerEntry.startingBalance - endingBalance = amendmentLedgerEntry.endingBalance amount = amendmentLedgerEntry.amount - currency = amendmentLedgerEntry.currency createdAt = amendmentLedgerEntry.createdAt - description = amendmentLedgerEntry.description creditBlock = amendmentLedgerEntry.creditBlock + currency = amendmentLedgerEntry.currency + customer = amendmentLedgerEntry.customer + description = amendmentLedgerEntry.description + endingBalance = amendmentLedgerEntry.endingBalance + entryStatus = amendmentLedgerEntry.entryStatus entryType = amendmentLedgerEntry.entryType + ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber + metadata = amendmentLedgerEntry.metadata + startingBalance = amendmentLedgerEntry.startingBalance additionalProperties = amendmentLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -5281,36 +5273,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5332,19 +5332,19 @@ private constructor( fun build(): AmendmentLedgerEntry = AmendmentLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -5799,16 +5799,16 @@ private constructor( return true } - return /* spotless:off */ other is AmendmentLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmendmentLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmendmentLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "AmendmentLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt index 80787347..668f951b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt @@ -158,31 +158,66 @@ constructor( this.externalCustomerId = externalCustomerId } - 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)) /** The ledger currency or custom pricing unit to use. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** The ledger currency or custom pricing unit to use. */ + fun currency(currency: Optional) = currency(currency.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)) + + fun entryStatus(entryStatus: EntryStatus?) = apply { this.entryStatus = entryStatus } - fun entryStatus(entryStatus: EntryStatus) = apply { this.entryStatus = entryStatus } + fun entryStatus(entryStatus: Optional) = entryStatus(entryStatus.orElse(null)) - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun entryType(entryType: EntryType?) = apply { this.entryType = entryType } + + fun entryType(entryType: Optional) = entryType(entryType.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?) + + fun minimumAmount(minimumAmount: String?) = apply { this.minimumAmount = minimumAmount } - fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt index 82214bd0..48b9960e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt @@ -377,112 +377,112 @@ private constructor( class IncrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -492,19 +492,19 @@ private constructor( fun validate(): IncrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -518,79 +518,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - metadata = incrementLedgerEntry.metadata id = incrementLedgerEntry.id - ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber - entryStatus = incrementLedgerEntry.entryStatus - customer = incrementLedgerEntry.customer - startingBalance = incrementLedgerEntry.startingBalance - endingBalance = incrementLedgerEntry.endingBalance amount = incrementLedgerEntry.amount - currency = incrementLedgerEntry.currency createdAt = incrementLedgerEntry.createdAt - description = incrementLedgerEntry.description creditBlock = incrementLedgerEntry.creditBlock + currency = incrementLedgerEntry.currency + customer = incrementLedgerEntry.customer + description = incrementLedgerEntry.description + endingBalance = incrementLedgerEntry.endingBalance + entryStatus = incrementLedgerEntry.entryStatus entryType = incrementLedgerEntry.entryType + ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber + metadata = incrementLedgerEntry.metadata + startingBalance = incrementLedgerEntry.startingBalance additionalProperties = incrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -599,36 +591,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -650,19 +650,19 @@ private constructor( fun build(): IncrementLedgerEntry = IncrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -1117,151 +1117,151 @@ private constructor( return true } - return /* spotless:off */ other is IncrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IncrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IncrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "IncrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class DecrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("price_id") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("event_id") @ExcludeMissing private val eventId: JsonField = JsonMissing.of(), @JsonProperty("invoice_id") @ExcludeMissing private val invoiceId: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + /** + * 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("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("event_id") @ExcludeMissing fun _eventId() = eventId @JsonProperty("invoice_id") @ExcludeMissing fun _invoiceId() = invoiceId + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1270,22 +1270,22 @@ private constructor( fun validate(): DecrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - priceId() + ledgerSequenceNumber() + metadata().validate() + startingBalance() eventId() invoiceId() + priceId() validated = true } } @@ -1299,85 +1299,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var priceId: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var eventId: JsonField = JsonMissing.of() private var invoiceId: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - metadata = decrementLedgerEntry.metadata id = decrementLedgerEntry.id - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - entryStatus = decrementLedgerEntry.entryStatus - customer = decrementLedgerEntry.customer - startingBalance = decrementLedgerEntry.startingBalance - endingBalance = decrementLedgerEntry.endingBalance amount = decrementLedgerEntry.amount - currency = decrementLedgerEntry.currency createdAt = decrementLedgerEntry.createdAt - description = decrementLedgerEntry.description creditBlock = decrementLedgerEntry.creditBlock + currency = decrementLedgerEntry.currency + customer = decrementLedgerEntry.customer + description = decrementLedgerEntry.description + endingBalance = decrementLedgerEntry.endingBalance + entryStatus = decrementLedgerEntry.entryStatus entryType = decrementLedgerEntry.entryType - priceId = decrementLedgerEntry.priceId + ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber + metadata = decrementLedgerEntry.metadata + startingBalance = decrementLedgerEntry.startingBalance eventId = decrementLedgerEntry.eventId invoiceId = decrementLedgerEntry.invoiceId + priceId = decrementLedgerEntry.priceId additionalProperties = decrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -1386,39 +1378,43 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 priceId(priceId: String) = priceId(JsonField.of(priceId)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun eventId(eventId: String) = eventId(JsonField.of(eventId)) @@ -1428,6 +1424,10 @@ private constructor( fun invoiceId(invoiceId: JsonField) = apply { this.invoiceId = invoiceId } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1449,22 +1449,22 @@ private constructor( fun build(): DecrementLedgerEntry = DecrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - priceId, + ledgerSequenceNumber, + metadata, + startingBalance, eventId, invoiceId, + priceId, additionalProperties.toImmutable(), ) } @@ -1919,140 +1919,140 @@ private constructor( return true } - return /* spotless:off */ other is DecrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && priceId == other.priceId && eventId == other.eventId && invoiceId == other.invoiceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is DecrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && eventId == other.eventId && invoiceId == other.invoiceId && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, priceId, eventId, invoiceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, eventId, invoiceId, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "DecrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, priceId=$priceId, eventId=$eventId, invoiceId=$invoiceId, additionalProperties=$additionalProperties}" + "DecrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, eventId=$eventId, invoiceId=$invoiceId, priceId=$priceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class ExpirationChangeLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") - fun newBlockExpiryDate(): Optional = - Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): Optional = + Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2061,20 +2061,20 @@ private constructor( fun validate(): ExpirationChangeLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() + startingBalance() validated = true } } @@ -2088,82 +2088,74 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - metadata = expirationChangeLedgerEntry.metadata id = expirationChangeLedgerEntry.id - ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber - entryStatus = expirationChangeLedgerEntry.entryStatus - customer = expirationChangeLedgerEntry.customer - startingBalance = expirationChangeLedgerEntry.startingBalance - endingBalance = expirationChangeLedgerEntry.endingBalance amount = expirationChangeLedgerEntry.amount - currency = expirationChangeLedgerEntry.currency createdAt = expirationChangeLedgerEntry.createdAt - description = expirationChangeLedgerEntry.description creditBlock = expirationChangeLedgerEntry.creditBlock + currency = expirationChangeLedgerEntry.currency + customer = expirationChangeLedgerEntry.customer + description = expirationChangeLedgerEntry.description + endingBalance = expirationChangeLedgerEntry.endingBalance + entryStatus = expirationChangeLedgerEntry.entryStatus entryType = expirationChangeLedgerEntry.entryType + ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber + metadata = expirationChangeLedgerEntry.metadata newBlockExpiryDate = expirationChangeLedgerEntry.newBlockExpiryDate + startingBalance = expirationChangeLedgerEntry.startingBalance additionalProperties = expirationChangeLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2172,35 +2164,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -2209,6 +2202,13 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) + + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2230,20 +2230,20 @@ private constructor( fun build(): ExpirationChangeLedgerEntry = ExpirationChangeLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, + startingBalance, additionalProperties.toImmutable(), ) } @@ -2698,129 +2698,129 @@ private constructor( return true } - return /* spotless:off */ other is ExpirationChangeLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ExpirationChangeLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ExpirationChangeLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, additionalProperties=$additionalProperties}" + "ExpirationChangeLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class CreditBlockExpiryLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -2830,19 +2830,19 @@ private constructor( fun validate(): CreditBlockExpiryLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -2856,80 +2856,72 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - metadata = creditBlockExpiryLedgerEntry.metadata id = creditBlockExpiryLedgerEntry.id - ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber - entryStatus = creditBlockExpiryLedgerEntry.entryStatus - customer = creditBlockExpiryLedgerEntry.customer - startingBalance = creditBlockExpiryLedgerEntry.startingBalance - endingBalance = creditBlockExpiryLedgerEntry.endingBalance amount = creditBlockExpiryLedgerEntry.amount - currency = creditBlockExpiryLedgerEntry.currency createdAt = creditBlockExpiryLedgerEntry.createdAt - description = creditBlockExpiryLedgerEntry.description creditBlock = creditBlockExpiryLedgerEntry.creditBlock + currency = creditBlockExpiryLedgerEntry.currency + customer = creditBlockExpiryLedgerEntry.customer + description = creditBlockExpiryLedgerEntry.description + endingBalance = creditBlockExpiryLedgerEntry.endingBalance + entryStatus = creditBlockExpiryLedgerEntry.entryStatus entryType = creditBlockExpiryLedgerEntry.entryType + ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber + metadata = creditBlockExpiryLedgerEntry.metadata + startingBalance = creditBlockExpiryLedgerEntry.startingBalance additionalProperties = creditBlockExpiryLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2938,36 +2930,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2989,19 +2989,19 @@ private constructor( fun build(): CreditBlockExpiryLedgerEntry = CreditBlockExpiryLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -3456,145 +3456,145 @@ private constructor( return true } - return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditBlockExpiryLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "CreditBlockExpiryLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3603,21 +3603,21 @@ private constructor( fun validate(): VoidLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - voidReason() + ledgerSequenceNumber() + metadata().validate() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -3631,83 +3631,75 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - metadata = voidLedgerEntry.metadata id = voidLedgerEntry.id - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - entryStatus = voidLedgerEntry.entryStatus - customer = voidLedgerEntry.customer - startingBalance = voidLedgerEntry.startingBalance - endingBalance = voidLedgerEntry.endingBalance amount = voidLedgerEntry.amount - currency = voidLedgerEntry.currency createdAt = voidLedgerEntry.createdAt - description = voidLedgerEntry.description creditBlock = voidLedgerEntry.creditBlock + currency = voidLedgerEntry.currency + customer = voidLedgerEntry.customer + description = voidLedgerEntry.description + endingBalance = voidLedgerEntry.endingBalance + entryStatus = voidLedgerEntry.entryStatus entryType = voidLedgerEntry.entryType - voidReason = voidLedgerEntry.voidReason + ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber + metadata = voidLedgerEntry.metadata + startingBalance = voidLedgerEntry.startingBalance voidAmount = voidLedgerEntry.voidAmount + voidReason = voidLedgerEntry.voidReason additionalProperties = voidLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -3716,44 +3708,52 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } - fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - - fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3775,21 +3775,21 @@ private constructor( fun build(): VoidLedgerEntry = VoidLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - voidReason, + ledgerSequenceNumber, + metadata, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -4244,155 +4244,155 @@ private constructor( return true } - return /* spotless:off */ other is VoidLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidInitiatedLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("starting_balance") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun newBlockExpiryDate(): OffsetDateTime = - newBlockExpiryDate.getRequired("new_block_expiry_date") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): OffsetDateTime = + newBlockExpiryDate.getRequired("new_block_expiry_date") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4401,22 +4401,22 @@ private constructor( fun validate(): VoidInitiatedLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() - voidReason() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -4430,85 +4430,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - metadata = voidInitiatedLedgerEntry.metadata id = voidInitiatedLedgerEntry.id - ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber - entryStatus = voidInitiatedLedgerEntry.entryStatus - customer = voidInitiatedLedgerEntry.customer - startingBalance = voidInitiatedLedgerEntry.startingBalance - endingBalance = voidInitiatedLedgerEntry.endingBalance amount = voidInitiatedLedgerEntry.amount - currency = voidInitiatedLedgerEntry.currency createdAt = voidInitiatedLedgerEntry.createdAt - description = voidInitiatedLedgerEntry.description creditBlock = voidInitiatedLedgerEntry.creditBlock + currency = voidInitiatedLedgerEntry.currency + customer = voidInitiatedLedgerEntry.customer + description = voidInitiatedLedgerEntry.description + endingBalance = voidInitiatedLedgerEntry.endingBalance + entryStatus = voidInitiatedLedgerEntry.entryStatus entryType = voidInitiatedLedgerEntry.entryType + ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber + metadata = voidInitiatedLedgerEntry.metadata newBlockExpiryDate = voidInitiatedLedgerEntry.newBlockExpiryDate - voidReason = voidInitiatedLedgerEntry.voidReason + startingBalance = voidInitiatedLedgerEntry.startingBalance voidAmount = voidInitiatedLedgerEntry.voidAmount + voidReason = voidInitiatedLedgerEntry.voidReason additionalProperties = voidInitiatedLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -4517,35 +4509,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -4554,14 +4547,21 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } - fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } + fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + + fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4583,22 +4583,22 @@ private constructor( fun build(): VoidInitiatedLedgerEntry = VoidInitiatedLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, - voidReason, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -5053,129 +5053,129 @@ private constructor( return true } - return /* spotless:off */ other is VoidInitiatedLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidInitiatedLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidInitiatedLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidInitiatedLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class AmendmentLedgerEntry @JsonCreator - private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -5185,19 +5185,19 @@ private constructor( fun validate(): AmendmentLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -5211,79 +5211,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - metadata = amendmentLedgerEntry.metadata id = amendmentLedgerEntry.id - ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber - entryStatus = amendmentLedgerEntry.entryStatus - customer = amendmentLedgerEntry.customer - startingBalance = amendmentLedgerEntry.startingBalance - endingBalance = amendmentLedgerEntry.endingBalance amount = amendmentLedgerEntry.amount - currency = amendmentLedgerEntry.currency createdAt = amendmentLedgerEntry.createdAt - description = amendmentLedgerEntry.description creditBlock = amendmentLedgerEntry.creditBlock + currency = amendmentLedgerEntry.currency + customer = amendmentLedgerEntry.customer + description = amendmentLedgerEntry.description + endingBalance = amendmentLedgerEntry.endingBalance + entryStatus = amendmentLedgerEntry.entryStatus entryType = amendmentLedgerEntry.entryType + ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber + metadata = amendmentLedgerEntry.metadata + startingBalance = amendmentLedgerEntry.startingBalance additionalProperties = amendmentLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -5292,36 +5284,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5343,19 +5343,19 @@ private constructor( fun build(): AmendmentLedgerEntry = AmendmentLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -5810,16 +5810,16 @@ private constructor( return true } - return /* spotless:off */ other is AmendmentLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmendmentLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmendmentLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "AmendmentLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt index e2b53fff..5f8c9371 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt @@ -152,31 +152,66 @@ constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } - 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)) /** The ledger currency or custom pricing unit to use. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** The ledger currency or custom pricing unit to use. */ + fun currency(currency: Optional) = currency(currency.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)) + + fun entryStatus(entryStatus: EntryStatus?) = apply { this.entryStatus = entryStatus } - fun entryStatus(entryStatus: EntryStatus) = apply { this.entryStatus = entryStatus } + fun entryStatus(entryStatus: Optional) = entryStatus(entryStatus.orElse(null)) - fun entryType(entryType: EntryType) = apply { this.entryType = entryType } + fun entryType(entryType: EntryType?) = apply { this.entryType = entryType } + + fun entryType(entryType: Optional) = entryType(entryType.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?) + + fun minimumAmount(minimumAmount: String?) = apply { this.minimumAmount = minimumAmount } - fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt index dd7831b1..9465c031 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt @@ -357,112 +357,112 @@ private constructor( class IncrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -472,19 +472,19 @@ private constructor( fun validate(): IncrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -498,79 +498,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(incrementLedgerEntry: IncrementLedgerEntry) = apply { - metadata = incrementLedgerEntry.metadata id = incrementLedgerEntry.id - ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber - entryStatus = incrementLedgerEntry.entryStatus - customer = incrementLedgerEntry.customer - startingBalance = incrementLedgerEntry.startingBalance - endingBalance = incrementLedgerEntry.endingBalance amount = incrementLedgerEntry.amount - currency = incrementLedgerEntry.currency createdAt = incrementLedgerEntry.createdAt - description = incrementLedgerEntry.description creditBlock = incrementLedgerEntry.creditBlock + currency = incrementLedgerEntry.currency + customer = incrementLedgerEntry.customer + description = incrementLedgerEntry.description + endingBalance = incrementLedgerEntry.endingBalance + entryStatus = incrementLedgerEntry.entryStatus entryType = incrementLedgerEntry.entryType + ledgerSequenceNumber = incrementLedgerEntry.ledgerSequenceNumber + metadata = incrementLedgerEntry.metadata + startingBalance = incrementLedgerEntry.startingBalance additionalProperties = incrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -579,36 +571,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -630,19 +630,19 @@ private constructor( fun build(): IncrementLedgerEntry = IncrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -1097,151 +1097,151 @@ private constructor( return true } - return /* spotless:off */ other is IncrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IncrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IncrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "IncrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class DecrementLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("price_id") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("event_id") @ExcludeMissing private val eventId: JsonField = JsonMissing.of(), @JsonProperty("invoice_id") @ExcludeMissing private val invoiceId: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun eventId(): Optional = Optional.ofNullable(eventId.getNullable("event_id")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun invoiceId(): Optional = Optional.ofNullable(invoiceId.getNullable("invoice_id")) - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun priceId(): Optional = Optional.ofNullable(priceId.getNullable("price_id")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + /** + * 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("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("event_id") @ExcludeMissing fun _eventId() = eventId @JsonProperty("invoice_id") @ExcludeMissing fun _invoiceId() = invoiceId + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1250,22 +1250,22 @@ private constructor( fun validate(): DecrementLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - priceId() + ledgerSequenceNumber() + metadata().validate() + startingBalance() eventId() invoiceId() + priceId() validated = true } } @@ -1279,85 +1279,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var priceId: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var eventId: JsonField = JsonMissing.of() private var invoiceId: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decrementLedgerEntry: DecrementLedgerEntry) = apply { - metadata = decrementLedgerEntry.metadata id = decrementLedgerEntry.id - ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber - entryStatus = decrementLedgerEntry.entryStatus - customer = decrementLedgerEntry.customer - startingBalance = decrementLedgerEntry.startingBalance - endingBalance = decrementLedgerEntry.endingBalance amount = decrementLedgerEntry.amount - currency = decrementLedgerEntry.currency createdAt = decrementLedgerEntry.createdAt - description = decrementLedgerEntry.description creditBlock = decrementLedgerEntry.creditBlock + currency = decrementLedgerEntry.currency + customer = decrementLedgerEntry.customer + description = decrementLedgerEntry.description + endingBalance = decrementLedgerEntry.endingBalance + entryStatus = decrementLedgerEntry.entryStatus entryType = decrementLedgerEntry.entryType - priceId = decrementLedgerEntry.priceId + ledgerSequenceNumber = decrementLedgerEntry.ledgerSequenceNumber + metadata = decrementLedgerEntry.metadata + startingBalance = decrementLedgerEntry.startingBalance eventId = decrementLedgerEntry.eventId invoiceId = decrementLedgerEntry.invoiceId + priceId = decrementLedgerEntry.priceId additionalProperties = decrementLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -1366,39 +1358,43 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 priceId(priceId: String) = priceId(JsonField.of(priceId)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun eventId(eventId: String) = eventId(JsonField.of(eventId)) @@ -1408,6 +1404,10 @@ private constructor( fun invoiceId(invoiceId: JsonField) = apply { this.invoiceId = invoiceId } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1429,22 +1429,22 @@ private constructor( fun build(): DecrementLedgerEntry = DecrementLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - priceId, + ledgerSequenceNumber, + metadata, + startingBalance, eventId, invoiceId, + priceId, additionalProperties.toImmutable(), ) } @@ -1899,140 +1899,140 @@ private constructor( return true } - return /* spotless:off */ other is DecrementLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && priceId == other.priceId && eventId == other.eventId && invoiceId == other.invoiceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is DecrementLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && eventId == other.eventId && invoiceId == other.invoiceId && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, priceId, eventId, invoiceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, eventId, invoiceId, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "DecrementLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, priceId=$priceId, eventId=$eventId, invoiceId=$invoiceId, additionalProperties=$additionalProperties}" + "DecrementLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, eventId=$eventId, invoiceId=$invoiceId, priceId=$priceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class ExpirationChangeLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") - fun newBlockExpiryDate(): Optional = - Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): Optional = + Optional.ofNullable(newBlockExpiryDate.getNullable("new_block_expiry_date")) - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2041,20 +2041,20 @@ private constructor( fun validate(): ExpirationChangeLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() + startingBalance() validated = true } } @@ -2068,82 +2068,74 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(expirationChangeLedgerEntry: ExpirationChangeLedgerEntry) = apply { - metadata = expirationChangeLedgerEntry.metadata id = expirationChangeLedgerEntry.id - ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber - entryStatus = expirationChangeLedgerEntry.entryStatus - customer = expirationChangeLedgerEntry.customer - startingBalance = expirationChangeLedgerEntry.startingBalance - endingBalance = expirationChangeLedgerEntry.endingBalance amount = expirationChangeLedgerEntry.amount - currency = expirationChangeLedgerEntry.currency createdAt = expirationChangeLedgerEntry.createdAt - description = expirationChangeLedgerEntry.description creditBlock = expirationChangeLedgerEntry.creditBlock + currency = expirationChangeLedgerEntry.currency + customer = expirationChangeLedgerEntry.customer + description = expirationChangeLedgerEntry.description + endingBalance = expirationChangeLedgerEntry.endingBalance + entryStatus = expirationChangeLedgerEntry.entryStatus entryType = expirationChangeLedgerEntry.entryType + ledgerSequenceNumber = expirationChangeLedgerEntry.ledgerSequenceNumber + metadata = expirationChangeLedgerEntry.metadata newBlockExpiryDate = expirationChangeLedgerEntry.newBlockExpiryDate + startingBalance = expirationChangeLedgerEntry.startingBalance additionalProperties = expirationChangeLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2152,35 +2144,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -2189,6 +2182,13 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) + + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2210,20 +2210,20 @@ private constructor( fun build(): ExpirationChangeLedgerEntry = ExpirationChangeLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, + startingBalance, additionalProperties.toImmutable(), ) } @@ -2678,129 +2678,129 @@ private constructor( return true } - return /* spotless:off */ other is ExpirationChangeLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ExpirationChangeLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ExpirationChangeLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, additionalProperties=$additionalProperties}" + "ExpirationChangeLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class CreditBlockExpiryLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -2810,19 +2810,19 @@ private constructor( fun validate(): CreditBlockExpiryLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -2836,80 +2836,72 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry) = apply { - metadata = creditBlockExpiryLedgerEntry.metadata id = creditBlockExpiryLedgerEntry.id - ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber - entryStatus = creditBlockExpiryLedgerEntry.entryStatus - customer = creditBlockExpiryLedgerEntry.customer - startingBalance = creditBlockExpiryLedgerEntry.startingBalance - endingBalance = creditBlockExpiryLedgerEntry.endingBalance amount = creditBlockExpiryLedgerEntry.amount - currency = creditBlockExpiryLedgerEntry.currency createdAt = creditBlockExpiryLedgerEntry.createdAt - description = creditBlockExpiryLedgerEntry.description creditBlock = creditBlockExpiryLedgerEntry.creditBlock + currency = creditBlockExpiryLedgerEntry.currency + customer = creditBlockExpiryLedgerEntry.customer + description = creditBlockExpiryLedgerEntry.description + endingBalance = creditBlockExpiryLedgerEntry.endingBalance + entryStatus = creditBlockExpiryLedgerEntry.entryStatus entryType = creditBlockExpiryLedgerEntry.entryType + ledgerSequenceNumber = creditBlockExpiryLedgerEntry.ledgerSequenceNumber + metadata = creditBlockExpiryLedgerEntry.metadata + startingBalance = creditBlockExpiryLedgerEntry.startingBalance additionalProperties = creditBlockExpiryLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -2918,36 +2910,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2969,19 +2969,19 @@ private constructor( fun build(): CreditBlockExpiryLedgerEntry = CreditBlockExpiryLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -3436,145 +3436,145 @@ private constructor( return true } - return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditBlockExpiryLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditBlockExpiryLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "CreditBlockExpiryLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("ledger_sequence_number") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3583,21 +3583,21 @@ private constructor( fun validate(): VoidLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() - voidReason() + ledgerSequenceNumber() + metadata().validate() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -3611,83 +3611,75 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidLedgerEntry: VoidLedgerEntry) = apply { - metadata = voidLedgerEntry.metadata id = voidLedgerEntry.id - ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber - entryStatus = voidLedgerEntry.entryStatus - customer = voidLedgerEntry.customer - startingBalance = voidLedgerEntry.startingBalance - endingBalance = voidLedgerEntry.endingBalance amount = voidLedgerEntry.amount - currency = voidLedgerEntry.currency createdAt = voidLedgerEntry.createdAt - description = voidLedgerEntry.description creditBlock = voidLedgerEntry.creditBlock + currency = voidLedgerEntry.currency + customer = voidLedgerEntry.customer + description = voidLedgerEntry.description + endingBalance = voidLedgerEntry.endingBalance + entryStatus = voidLedgerEntry.entryStatus entryType = voidLedgerEntry.entryType - voidReason = voidLedgerEntry.voidReason + ledgerSequenceNumber = voidLedgerEntry.ledgerSequenceNumber + metadata = voidLedgerEntry.metadata + startingBalance = voidLedgerEntry.startingBalance voidAmount = voidLedgerEntry.voidAmount + voidReason = voidLedgerEntry.voidReason additionalProperties = voidLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -3696,44 +3688,52 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } - fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) - - fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3755,21 +3755,21 @@ private constructor( fun build(): VoidLedgerEntry = VoidLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, - voidReason, + ledgerSequenceNumber, + metadata, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -4224,155 +4224,155 @@ private constructor( return true } - return /* spotless:off */ other is VoidLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class VoidInitiatedLedgerEntry @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("new_block_expiry_date") @ExcludeMissing private val newBlockExpiryDate: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") + @JsonProperty("starting_balance") @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), @JsonProperty("void_amount") @ExcludeMissing private val voidAmount: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") - - fun entryType(): EntryType = entryType.getRequired("entry_type") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") - fun newBlockExpiryDate(): OffsetDateTime = - newBlockExpiryDate.getRequired("new_block_expiry_date") + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) + fun entryType(): EntryType = entryType.getRequired("entry_type") - fun voidAmount(): Double = voidAmount.getRequired("void_amount") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") /** * 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("id") @ExcludeMissing fun _id() = id + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + fun newBlockExpiryDate(): OffsetDateTime = + newBlockExpiryDate.getRequired("new_block_expiry_date") - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun voidAmount(): Double = voidAmount.getRequired("void_amount") - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) - @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance + + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber + + /** + * 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("new_block_expiry_date") @ExcludeMissing fun _newBlockExpiryDate() = newBlockExpiryDate - @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonProperty("void_amount") @ExcludeMissing fun _voidAmount() = voidAmount + @JsonProperty("void_reason") @ExcludeMissing fun _voidReason() = voidReason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4381,22 +4381,22 @@ private constructor( fun validate(): VoidInitiatedLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() newBlockExpiryDate() - voidReason() + startingBalance() voidAmount() + voidReason() validated = true } } @@ -4410,85 +4410,77 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var newBlockExpiryDate: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var voidAmount: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry) = apply { - metadata = voidInitiatedLedgerEntry.metadata id = voidInitiatedLedgerEntry.id - ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber - entryStatus = voidInitiatedLedgerEntry.entryStatus - customer = voidInitiatedLedgerEntry.customer - startingBalance = voidInitiatedLedgerEntry.startingBalance - endingBalance = voidInitiatedLedgerEntry.endingBalance amount = voidInitiatedLedgerEntry.amount - currency = voidInitiatedLedgerEntry.currency createdAt = voidInitiatedLedgerEntry.createdAt - description = voidInitiatedLedgerEntry.description creditBlock = voidInitiatedLedgerEntry.creditBlock + currency = voidInitiatedLedgerEntry.currency + customer = voidInitiatedLedgerEntry.customer + description = voidInitiatedLedgerEntry.description + endingBalance = voidInitiatedLedgerEntry.endingBalance + entryStatus = voidInitiatedLedgerEntry.entryStatus entryType = voidInitiatedLedgerEntry.entryType + ledgerSequenceNumber = voidInitiatedLedgerEntry.ledgerSequenceNumber + metadata = voidInitiatedLedgerEntry.metadata newBlockExpiryDate = voidInitiatedLedgerEntry.newBlockExpiryDate - voidReason = voidInitiatedLedgerEntry.voidReason + startingBalance = voidInitiatedLedgerEntry.startingBalance voidAmount = voidInitiatedLedgerEntry.voidAmount + voidReason = voidInitiatedLedgerEntry.voidReason additionalProperties = voidInitiatedLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -4497,35 +4489,36 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) - - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus } - fun description(description: String) = description(JsonField.of(description)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun description(description: JsonField) = apply { - this.description = description - } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * 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 newBlockExpiryDate(newBlockExpiryDate: OffsetDateTime) = newBlockExpiryDate(JsonField.of(newBlockExpiryDate)) @@ -4534,14 +4527,21 @@ private constructor( this.newBlockExpiryDate = newBlockExpiryDate } - fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance + } fun voidAmount(voidAmount: Double) = voidAmount(JsonField.of(voidAmount)) fun voidAmount(voidAmount: JsonField) = apply { this.voidAmount = voidAmount } + fun voidReason(voidReason: String) = voidReason(JsonField.of(voidReason)) + + fun voidReason(voidReason: JsonField) = apply { this.voidReason = voidReason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4563,22 +4563,22 @@ private constructor( fun build(): VoidInitiatedLedgerEntry = VoidInitiatedLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, newBlockExpiryDate, - voidReason, + startingBalance, voidAmount, + voidReason, additionalProperties.toImmutable(), ) } @@ -5033,129 +5033,129 @@ private constructor( return true } - return /* spotless:off */ other is VoidInitiatedLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && newBlockExpiryDate == other.newBlockExpiryDate && voidReason == other.voidReason && voidAmount == other.voidAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is VoidInitiatedLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && newBlockExpiryDate == other.newBlockExpiryDate && startingBalance == other.startingBalance && voidAmount == other.voidAmount && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, newBlockExpiryDate, voidReason, voidAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, newBlockExpiryDate, startingBalance, voidAmount, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "VoidInitiatedLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, newBlockExpiryDate=$newBlockExpiryDate, voidReason=$voidReason, voidAmount=$voidAmount, additionalProperties=$additionalProperties}" + "VoidInitiatedLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, newBlockExpiryDate=$newBlockExpiryDate, startingBalance=$startingBalance, voidAmount=$voidAmount, voidReason=$voidReason, additionalProperties=$additionalProperties}" } @NoAutoDetect class AmendmentLedgerEntry @JsonCreator - private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), + private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - private val ledgerSequenceNumber: JsonField = JsonMissing.of(), - @JsonProperty("entry_status") - @ExcludeMissing - private val entryStatus: JsonField = JsonMissing.of(), - @JsonProperty("customer") - @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") - @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_block") + @ExcludeMissing + private val creditBlock: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("customer") @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), + private val customer: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), - @JsonProperty("credit_block") + @JsonProperty("ending_balance") @ExcludeMissing - private val creditBlock: JsonField = JsonMissing.of(), + private val endingBalance: JsonField = JsonMissing.of(), + @JsonProperty("entry_status") + @ExcludeMissing + private val entryStatus: JsonField = JsonMissing.of(), @JsonProperty("entry_type") @ExcludeMissing private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + private val ledgerSequenceNumber: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("starting_balance") + @ExcludeMissing + private val startingBalance: 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 ledgerSequenceNumber(): Long = - ledgerSequenceNumber.getRequired("ledger_sequence_number") - - fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") - - fun customer(): Customer = customer.getRequired("customer") - - fun startingBalance(): Double = startingBalance.getRequired("starting_balance") + fun amount(): Double = amount.getRequired("amount") - fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun amount(): Double = amount.getRequired("amount") + fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") fun currency(): String = currency.getRequired("currency") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun customer(): Customer = customer.getRequired("customer") fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - fun creditBlock(): CreditBlock = creditBlock.getRequired("credit_block") + fun endingBalance(): Double = endingBalance.getRequired("ending_balance") + + fun entryStatus(): EntryStatus = entryStatus.getRequired("entry_status") fun entryType(): EntryType = entryType.getRequired("entry_type") + fun ledgerSequenceNumber(): Long = + ledgerSequenceNumber.getRequired("ledger_sequence_number") + /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun startingBalance(): Double = startingBalance.getRequired("starting_balance") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("ledger_sequence_number") - @ExcludeMissing - fun _ledgerSequenceNumber() = ledgerSequenceNumber + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("customer") @ExcludeMissing fun _customer() = customer - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("entry_status") @ExcludeMissing fun _entryStatus() = entryStatus - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("entry_type") @ExcludeMissing fun _entryType() = entryType - @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("ledger_sequence_number") + @ExcludeMissing + fun _ledgerSequenceNumber() = ledgerSequenceNumber - @JsonProperty("credit_block") @ExcludeMissing fun _creditBlock() = creditBlock + /** + * 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("entry_type") @ExcludeMissing fun _entryType() = entryType + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance @JsonAnyGetter @ExcludeMissing @@ -5165,19 +5165,19 @@ private constructor( fun validate(): AmendmentLedgerEntry = apply { if (!validated) { - metadata().validate() id() - ledgerSequenceNumber() - entryStatus() - customer().validate() - startingBalance() - endingBalance() amount() - currency() createdAt() - description() creditBlock().validate() + currency() + customer().validate() + description() + endingBalance() + entryStatus() entryType() + ledgerSequenceNumber() + metadata().validate() + startingBalance() validated = true } } @@ -5191,79 +5191,71 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var ledgerSequenceNumber: JsonField = JsonMissing.of() - private var entryStatus: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() private var creditBlock: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() + private var entryStatus: JsonField = JsonMissing.of() private var entryType: JsonField = JsonMissing.of() + private var ledgerSequenceNumber: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amendmentLedgerEntry: AmendmentLedgerEntry) = apply { - metadata = amendmentLedgerEntry.metadata id = amendmentLedgerEntry.id - ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber - entryStatus = amendmentLedgerEntry.entryStatus - customer = amendmentLedgerEntry.customer - startingBalance = amendmentLedgerEntry.startingBalance - endingBalance = amendmentLedgerEntry.endingBalance amount = amendmentLedgerEntry.amount - currency = amendmentLedgerEntry.currency createdAt = amendmentLedgerEntry.createdAt - description = amendmentLedgerEntry.description creditBlock = amendmentLedgerEntry.creditBlock + currency = amendmentLedgerEntry.currency + customer = amendmentLedgerEntry.customer + description = amendmentLedgerEntry.description + endingBalance = amendmentLedgerEntry.endingBalance + entryStatus = amendmentLedgerEntry.entryStatus entryType = amendmentLedgerEntry.entryType + ledgerSequenceNumber = amendmentLedgerEntry.ledgerSequenceNumber + metadata = amendmentLedgerEntry.metadata + startingBalance = amendmentLedgerEntry.startingBalance additionalProperties = amendmentLedgerEntry.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 ledgerSequenceNumber(ledgerSequenceNumber: Long) = - ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { - this.ledgerSequenceNumber = ledgerSequenceNumber + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt } - fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) + fun creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) - fun entryStatus(entryStatus: JsonField) = apply { - this.entryStatus = entryStatus + fun creditBlock(creditBlock: JsonField) = apply { + this.creditBlock = creditBlock } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun customer(customer: Customer) = customer(JsonField.of(customer)) fun customer(customer: JsonField) = apply { this.customer = customer } - fun startingBalance(startingBalance: Double) = - startingBalance(JsonField.of(startingBalance)) + fun description(description: String) = description(JsonField.of(description)) - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun description(description: JsonField) = apply { + this.description = description } fun endingBalance(endingBalance: Double) = endingBalance(JsonField.of(endingBalance)) @@ -5272,36 +5264,44 @@ private constructor( this.endingBalance = endingBalance } - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun entryStatus(entryStatus: EntryStatus) = entryStatus(JsonField.of(entryStatus)) - fun amount(amount: JsonField) = apply { this.amount = amount } + fun entryStatus(entryStatus: JsonField) = apply { + this.entryStatus = entryStatus + } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + fun ledgerSequenceNumber(ledgerSequenceNumber: Long) = + ledgerSequenceNumber(JsonField.of(ledgerSequenceNumber)) - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + fun ledgerSequenceNumber(ledgerSequenceNumber: JsonField) = apply { + this.ledgerSequenceNumber = ledgerSequenceNumber } - fun description(description: String) = description(JsonField.of(description)) + /** + * 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)) - fun description(description: JsonField) = apply { - this.description = description - } + /** + * 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 creditBlock(creditBlock: CreditBlock) = creditBlock(JsonField.of(creditBlock)) + fun startingBalance(startingBalance: Double) = + startingBalance(JsonField.of(startingBalance)) - fun creditBlock(creditBlock: JsonField) = apply { - this.creditBlock = creditBlock + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5323,19 +5323,19 @@ private constructor( fun build(): AmendmentLedgerEntry = AmendmentLedgerEntry( - metadata, id, - ledgerSequenceNumber, - entryStatus, - customer, - startingBalance, - endingBalance, amount, - currency, createdAt, - description, creditBlock, + currency, + customer, + description, + endingBalance, + entryStatus, entryType, + ledgerSequenceNumber, + metadata, + startingBalance, additionalProperties.toImmutable(), ) } @@ -5790,16 +5790,16 @@ private constructor( return true } - return /* spotless:off */ other is AmendmentLedgerEntry && metadata == other.metadata && id == other.id && ledgerSequenceNumber == other.ledgerSequenceNumber && entryStatus == other.entryStatus && customer == other.customer && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && currency == other.currency && createdAt == other.createdAt && description == other.description && creditBlock == other.creditBlock && entryType == other.entryType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmendmentLedgerEntry && id == other.id && amount == other.amount && createdAt == other.createdAt && creditBlock == other.creditBlock && currency == other.currency && customer == other.customer && description == other.description && endingBalance == other.endingBalance && entryStatus == other.entryStatus && entryType == other.entryType && ledgerSequenceNumber == other.ledgerSequenceNumber && metadata == other.metadata && startingBalance == other.startingBalance && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, ledgerSequenceNumber, entryStatus, customer, startingBalance, endingBalance, amount, currency, createdAt, description, creditBlock, entryType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, creditBlock, currency, customer, description, endingBalance, entryStatus, entryType, ledgerSequenceNumber, metadata, startingBalance, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmendmentLedgerEntry{metadata=$metadata, id=$id, ledgerSequenceNumber=$ledgerSequenceNumber, entryStatus=$entryStatus, customer=$customer, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, currency=$currency, createdAt=$createdAt, description=$description, creditBlock=$creditBlock, entryType=$entryType, additionalProperties=$additionalProperties}" + "AmendmentLedgerEntry{id=$id, amount=$amount, createdAt=$createdAt, creditBlock=$creditBlock, currency=$currency, customer=$customer, description=$description, endingBalance=$endingBalance, entryStatus=$entryStatus, entryType=$entryType, ledgerSequenceNumber=$ledgerSequenceNumber, metadata=$metadata, startingBalance=$startingBalance, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt index d1bb47ff..0d5b699b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt @@ -99,24 +99,55 @@ constructor( } /** The ledger currency or custom pricing unit to use. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** The ledger currency or custom pricing unit to use. */ + fun currency(currency: Optional) = currency(currency.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 } + 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)) /** * If set to True, all expired and depleted blocks, as well as active block will be * returned. */ - fun includeAllBlocks(includeAllBlocks: Boolean) = apply { + fun includeAllBlocks(includeAllBlocks: Boolean?) = apply { this.includeAllBlocks = includeAllBlocks } + /** + * If set to True, all expired and depleted blocks, as well as active block will be + * returned. + */ + fun includeAllBlocks(includeAllBlocks: Boolean) = + includeAllBlocks(includeAllBlocks as Boolean?) + + /** + * If set to True, all expired and depleted blocks, as well as active block will be + * returned. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun includeAllBlocks(includeAllBlocks: Optional) = + includeAllBlocks(includeAllBlocks.orElse(null) as Boolean?) + + /** 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/CustomerCreditListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt index 96eaad8a..e48839cc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt @@ -33,15 +33,15 @@ private constructor( @JsonProperty("expiry_date") @ExcludeMissing private val expiryDate: JsonField = JsonMissing.of(), + @JsonProperty("maximum_initial_balance") + @ExcludeMissing + private val maximumInitialBalance: JsonField = JsonMissing.of(), @JsonProperty("per_unit_cost_basis") @ExcludeMissing private val perUnitCostBasis: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing private val status: JsonField = JsonMissing.of(), - @JsonProperty("maximum_initial_balance") - @ExcludeMissing - private val maximumInitialBalance: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -55,14 +55,14 @@ private constructor( fun expiryDate(): Optional = Optional.ofNullable(expiryDate.getNullable("expiry_date")) + fun maximumInitialBalance(): Optional = + Optional.ofNullable(maximumInitialBalance.getNullable("maximum_initial_balance")) + fun perUnitCostBasis(): Optional = Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis")) fun status(): Status = status.getRequired("status") - fun maximumInitialBalance(): Optional = - Optional.ofNullable(maximumInitialBalance.getNullable("maximum_initial_balance")) - @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("balance") @ExcludeMissing fun _balance() = balance @@ -71,14 +71,14 @@ private constructor( @JsonProperty("expiry_date") @ExcludeMissing fun _expiryDate() = expiryDate - @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis - - @JsonProperty("status") @ExcludeMissing fun _status() = status - @JsonProperty("maximum_initial_balance") @ExcludeMissing fun _maximumInitialBalance() = maximumInitialBalance + @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis + + @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -91,9 +91,9 @@ private constructor( balance() effectiveDate() expiryDate() + maximumInitialBalance() perUnitCostBasis() status() - maximumInitialBalance() validated = true } } @@ -111,9 +111,9 @@ private constructor( private var balance: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() private var expiryDate: JsonField = JsonMissing.of() + private var maximumInitialBalance: JsonField = JsonMissing.of() private var perUnitCostBasis: JsonField = JsonMissing.of() private var status: JsonField = JsonMissing.of() - private var maximumInitialBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -124,9 +124,9 @@ private constructor( balance = customerCreditListByExternalIdResponse.balance effectiveDate = customerCreditListByExternalIdResponse.effectiveDate expiryDate = customerCreditListByExternalIdResponse.expiryDate + maximumInitialBalance = customerCreditListByExternalIdResponse.maximumInitialBalance perUnitCostBasis = customerCreditListByExternalIdResponse.perUnitCostBasis status = customerCreditListByExternalIdResponse.status - maximumInitialBalance = customerCreditListByExternalIdResponse.maximumInitialBalance additionalProperties = customerCreditListByExternalIdResponse.additionalProperties.toMutableMap() } @@ -152,6 +152,13 @@ private constructor( this.expiryDate = expiryDate } + fun maximumInitialBalance(maximumInitialBalance: Double) = + maximumInitialBalance(JsonField.of(maximumInitialBalance)) + + fun maximumInitialBalance(maximumInitialBalance: JsonField) = apply { + this.maximumInitialBalance = maximumInitialBalance + } + fun perUnitCostBasis(perUnitCostBasis: String) = perUnitCostBasis(JsonField.of(perUnitCostBasis)) @@ -163,13 +170,6 @@ private constructor( fun status(status: JsonField) = apply { this.status = status } - fun maximumInitialBalance(maximumInitialBalance: Double) = - maximumInitialBalance(JsonField.of(maximumInitialBalance)) - - fun maximumInitialBalance(maximumInitialBalance: JsonField) = apply { - this.maximumInitialBalance = maximumInitialBalance - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -195,9 +195,9 @@ private constructor( balance, effectiveDate, expiryDate, + maximumInitialBalance, perUnitCostBasis, status, - maximumInitialBalance, additionalProperties.toImmutable(), ) } @@ -264,15 +264,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditListByExternalIdResponse && id == other.id && balance == other.balance && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && perUnitCostBasis == other.perUnitCostBasis && status == other.status && maximumInitialBalance == other.maximumInitialBalance && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditListByExternalIdResponse && id == other.id && balance == other.balance && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && maximumInitialBalance == other.maximumInitialBalance && perUnitCostBasis == other.perUnitCostBasis && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, balance, effectiveDate, expiryDate, perUnitCostBasis, status, maximumInitialBalance, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, balance, effectiveDate, expiryDate, maximumInitialBalance, perUnitCostBasis, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditListByExternalIdResponse{id=$id, balance=$balance, effectiveDate=$effectiveDate, expiryDate=$expiryDate, perUnitCostBasis=$perUnitCostBasis, status=$status, maximumInitialBalance=$maximumInitialBalance, additionalProperties=$additionalProperties}" + "CustomerCreditListByExternalIdResponse{id=$id, balance=$balance, effectiveDate=$effectiveDate, expiryDate=$expiryDate, maximumInitialBalance=$maximumInitialBalance, perUnitCostBasis=$perUnitCostBasis, status=$status, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt index 4386f7ac..7834e45b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt @@ -94,24 +94,55 @@ constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } /** The ledger currency or custom pricing unit to use. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** The ledger currency or custom pricing unit to use. */ + fun currency(currency: Optional) = currency(currency.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 } + 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)) /** * If set to True, all expired and depleted blocks, as well as active block will be * returned. */ - fun includeAllBlocks(includeAllBlocks: Boolean) = apply { + fun includeAllBlocks(includeAllBlocks: Boolean?) = apply { this.includeAllBlocks = includeAllBlocks } + /** + * If set to True, all expired and depleted blocks, as well as active block will be + * returned. + */ + fun includeAllBlocks(includeAllBlocks: Boolean) = + includeAllBlocks(includeAllBlocks as Boolean?) + + /** + * If set to True, all expired and depleted blocks, as well as active block will be + * returned. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun includeAllBlocks(includeAllBlocks: Optional) = + includeAllBlocks(includeAllBlocks.orElse(null) as Boolean?) + + /** 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/CustomerCreditListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt index 0b1dda6f..c568724b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt @@ -33,15 +33,15 @@ private constructor( @JsonProperty("expiry_date") @ExcludeMissing private val expiryDate: JsonField = JsonMissing.of(), + @JsonProperty("maximum_initial_balance") + @ExcludeMissing + private val maximumInitialBalance: JsonField = JsonMissing.of(), @JsonProperty("per_unit_cost_basis") @ExcludeMissing private val perUnitCostBasis: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing private val status: JsonField = JsonMissing.of(), - @JsonProperty("maximum_initial_balance") - @ExcludeMissing - private val maximumInitialBalance: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -55,14 +55,14 @@ private constructor( fun expiryDate(): Optional = Optional.ofNullable(expiryDate.getNullable("expiry_date")) + fun maximumInitialBalance(): Optional = + Optional.ofNullable(maximumInitialBalance.getNullable("maximum_initial_balance")) + fun perUnitCostBasis(): Optional = Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis")) fun status(): Status = status.getRequired("status") - fun maximumInitialBalance(): Optional = - Optional.ofNullable(maximumInitialBalance.getNullable("maximum_initial_balance")) - @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("balance") @ExcludeMissing fun _balance() = balance @@ -71,14 +71,14 @@ private constructor( @JsonProperty("expiry_date") @ExcludeMissing fun _expiryDate() = expiryDate - @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis - - @JsonProperty("status") @ExcludeMissing fun _status() = status - @JsonProperty("maximum_initial_balance") @ExcludeMissing fun _maximumInitialBalance() = maximumInitialBalance + @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis + + @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -91,9 +91,9 @@ private constructor( balance() effectiveDate() expiryDate() + maximumInitialBalance() perUnitCostBasis() status() - maximumInitialBalance() validated = true } } @@ -111,9 +111,9 @@ private constructor( private var balance: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() private var expiryDate: JsonField = JsonMissing.of() + private var maximumInitialBalance: JsonField = JsonMissing.of() private var perUnitCostBasis: JsonField = JsonMissing.of() private var status: JsonField = JsonMissing.of() - private var maximumInitialBalance: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -122,9 +122,9 @@ private constructor( balance = customerCreditListResponse.balance effectiveDate = customerCreditListResponse.effectiveDate expiryDate = customerCreditListResponse.expiryDate + maximumInitialBalance = customerCreditListResponse.maximumInitialBalance perUnitCostBasis = customerCreditListResponse.perUnitCostBasis status = customerCreditListResponse.status - maximumInitialBalance = customerCreditListResponse.maximumInitialBalance additionalProperties = customerCreditListResponse.additionalProperties.toMutableMap() } @@ -149,6 +149,13 @@ private constructor( this.expiryDate = expiryDate } + fun maximumInitialBalance(maximumInitialBalance: Double) = + maximumInitialBalance(JsonField.of(maximumInitialBalance)) + + fun maximumInitialBalance(maximumInitialBalance: JsonField) = apply { + this.maximumInitialBalance = maximumInitialBalance + } + fun perUnitCostBasis(perUnitCostBasis: String) = perUnitCostBasis(JsonField.of(perUnitCostBasis)) @@ -160,13 +167,6 @@ private constructor( fun status(status: JsonField) = apply { this.status = status } - fun maximumInitialBalance(maximumInitialBalance: Double) = - maximumInitialBalance(JsonField.of(maximumInitialBalance)) - - fun maximumInitialBalance(maximumInitialBalance: JsonField) = apply { - this.maximumInitialBalance = maximumInitialBalance - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -192,9 +192,9 @@ private constructor( balance, effectiveDate, expiryDate, + maximumInitialBalance, perUnitCostBasis, status, - maximumInitialBalance, additionalProperties.toImmutable(), ) } @@ -261,15 +261,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditListResponse && id == other.id && balance == other.balance && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && perUnitCostBasis == other.perUnitCostBasis && status == other.status && maximumInitialBalance == other.maximumInitialBalance && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditListResponse && id == other.id && balance == other.balance && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && maximumInitialBalance == other.maximumInitialBalance && perUnitCostBasis == other.perUnitCostBasis && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, balance, effectiveDate, expiryDate, perUnitCostBasis, status, maximumInitialBalance, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, balance, effectiveDate, expiryDate, maximumInitialBalance, perUnitCostBasis, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditListResponse{id=$id, balance=$balance, effectiveDate=$effectiveDate, expiryDate=$expiryDate, perUnitCostBasis=$perUnitCostBasis, status=$status, maximumInitialBalance=$maximumInitialBalance, additionalProperties=$additionalProperties}" + "CustomerCreditListResponse{id=$id, balance=$balance, effectiveDate=$effectiveDate, expiryDate=$expiryDate, maximumInitialBalance=$maximumInitialBalance, perUnitCostBasis=$perUnitCostBasis, status=$status, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt index b33af243..03ff4dff 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt @@ -191,13 +191,31 @@ constructor( * The number of days or months after which the top-up expires. If unspecified, it does * not expire. */ - fun expiresAfter(expiresAfter: Long) = apply { this.expiresAfter = expiresAfter } + fun expiresAfter(expiresAfter: Long?) = apply { this.expiresAfter = expiresAfter } + + /** + * The number of days or months after which the top-up expires. If unspecified, it does + * not expire. + */ + fun expiresAfter(expiresAfter: Long) = expiresAfter(expiresAfter as Long?) + + /** + * The number of days or months after which the top-up expires. If unspecified, it does + * not expire. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun expiresAfter(expiresAfter: Optional) = + expiresAfter(expiresAfter.orElse(null) as Long?) /** The unit of expires_after. */ - fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit) = apply { + fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit?) = apply { this.expiresAfterUnit = expiresAfterUnit } + /** The unit of expires_after. */ + fun expiresAfterUnit(expiresAfterUnit: Optional) = + expiresAfterUnit(expiresAfterUnit.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -313,13 +331,31 @@ constructor( * The number of days or months after which the top-up expires. If unspecified, it does not * expire. */ - fun expiresAfter(expiresAfter: Long) = apply { body.expiresAfter(expiresAfter) } + fun expiresAfter(expiresAfter: Long?) = apply { body.expiresAfter(expiresAfter) } + + /** + * The number of days or months after which the top-up expires. If unspecified, it does not + * expire. + */ + fun expiresAfter(expiresAfter: Long) = expiresAfter(expiresAfter as Long?) + + /** + * The number of days or months after which the top-up expires. If unspecified, it does not + * expire. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun expiresAfter(expiresAfter: Optional) = + expiresAfter(expiresAfter.orElse(null) as Long?) /** The unit of expires_after. */ - fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit) = apply { + fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit?) = apply { body.expiresAfterUnit(expiresAfterUnit) } + /** The unit of expires_after. */ + fun expiresAfterUnit(expiresAfterUnit: Optional) = + expiresAfterUnit(expiresAfterUnit.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -527,16 +563,34 @@ constructor( fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } /** An optional memo to display on the invoice. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String?) = apply { this.memo = memo } + + /** An optional memo to display on the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) /** * If true, new credit blocks created by this top-up will require that the corresponding * invoice is paid before they can be drawn down from. */ - fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = apply { + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean?) = apply { this.requireSuccessfulPayment = requireSuccessfulPayment } + /** + * If true, new credit blocks created by this top-up will require that the corresponding + * invoice is paid before they can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = + requireSuccessfulPayment(requireSuccessfulPayment as Boolean?) + + /** + * If true, new credit blocks created by this top-up will require that the corresponding + * invoice is paid before they can be drawn down from. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun requireSuccessfulPayment(requireSuccessfulPayment: Optional) = + requireSuccessfulPayment(requireSuccessfulPayment.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt index c50aebd4..c18400a8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt @@ -23,21 +23,21 @@ class CustomerCreditTopUpCreateByExternalIdResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("threshold") - @ExcludeMissing - private val threshold: JsonField = JsonMissing.of(), - @JsonProperty("amount") + @JsonProperty("invoice_settings") @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), + private val invoiceSettings: JsonField = JsonMissing.of(), @JsonProperty("per_unit_cost_basis") @ExcludeMissing private val perUnitCostBasis: JsonField = JsonMissing.of(), - @JsonProperty("invoice_settings") + @JsonProperty("threshold") @ExcludeMissing - private val invoiceSettings: JsonField = JsonMissing.of(), + private val threshold: JsonField = JsonMissing.of(), @JsonProperty("expires_after") @ExcludeMissing private val expiresAfter: JsonField = JsonMissing.of(), @@ -49,27 +49,27 @@ private constructor( fun id(): String = id.getRequired("id") + /** The amount to increment when the threshold is reached. */ + fun amount(): String = amount.getRequired("amount") + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ fun currency(): String = currency.getRequired("currency") + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") + + /** How much, in the customer's currency, to charge for each unit. */ + fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ fun threshold(): String = threshold.getRequired("threshold") - /** The amount to increment when the threshold is reached. */ - fun amount(): String = amount.getRequired("amount") - - /** How much, in the customer's currency, to charge for each unit. */ - fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") - - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -83,27 +83,27 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The amount to increment when the threshold is reached. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** Settings for invoices generated by triggered top-ups. */ + @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings + + /** How much, in the customer's currency, to charge for each unit. */ + @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ @JsonProperty("threshold") @ExcludeMissing fun _threshold() = threshold - /** The amount to increment when the threshold is reached. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - /** How much, in the customer's currency, to charge for each unit. */ - @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis - - /** Settings for invoices generated by triggered top-ups. */ - @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -122,11 +122,11 @@ private constructor( fun validate(): CustomerCreditTopUpCreateByExternalIdResponse = apply { if (!validated) { id() - currency() - threshold() amount() - perUnitCostBasis() + currency() invoiceSettings().validate() + perUnitCostBasis() + threshold() expiresAfter() expiresAfterUnit() validated = true @@ -143,11 +143,11 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() - private var threshold: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var perUnitCostBasis: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var invoiceSettings: JsonField = JsonMissing.of() + private var perUnitCostBasis: JsonField = JsonMissing.of() + private var threshold: JsonField = JsonMissing.of() private var expiresAfter: JsonField = JsonMissing.of() private var expiresAfterUnit: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -158,11 +158,11 @@ private constructor( CustomerCreditTopUpCreateByExternalIdResponse ) = apply { id = customerCreditTopUpCreateByExternalIdResponse.id - currency = customerCreditTopUpCreateByExternalIdResponse.currency - threshold = customerCreditTopUpCreateByExternalIdResponse.threshold amount = customerCreditTopUpCreateByExternalIdResponse.amount - perUnitCostBasis = customerCreditTopUpCreateByExternalIdResponse.perUnitCostBasis + currency = customerCreditTopUpCreateByExternalIdResponse.currency invoiceSettings = customerCreditTopUpCreateByExternalIdResponse.invoiceSettings + perUnitCostBasis = customerCreditTopUpCreateByExternalIdResponse.perUnitCostBasis + threshold = customerCreditTopUpCreateByExternalIdResponse.threshold expiresAfter = customerCreditTopUpCreateByExternalIdResponse.expiresAfter expiresAfterUnit = customerCreditTopUpCreateByExternalIdResponse.expiresAfterUnit additionalProperties = @@ -173,6 +173,12 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The amount to increment when the threshold is reached. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount to increment when the threshold is reached. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world * currency, it must match the customer's invoicing currency. @@ -185,23 +191,14 @@ private constructor( */ fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: JsonField) = apply { this.threshold = threshold } - - /** The amount to increment when the threshold is reached. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: InvoiceSettings) = + invoiceSettings(JsonField.of(invoiceSettings)) - /** The amount to increment when the threshold is reached. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: JsonField) = apply { + this.invoiceSettings = invoiceSettings + } /** How much, in the customer's currency, to charge for each unit. */ fun perUnitCostBasis(perUnitCostBasis: String) = @@ -212,14 +209,17 @@ private constructor( this.perUnitCostBasis = perUnitCostBasis } - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: InvoiceSettings) = - invoiceSettings(JsonField.of(invoiceSettings)) + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: JsonField) = apply { - this.invoiceSettings = invoiceSettings - } + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: JsonField) = apply { this.threshold = threshold } /** * The number of days or months after which the top-up expires. If unspecified, it does not @@ -264,11 +264,11 @@ private constructor( fun build(): CustomerCreditTopUpCreateByExternalIdResponse = CustomerCreditTopUpCreateByExternalIdResponse( id, - currency, - threshold, amount, - perUnitCostBasis, + currency, invoiceSettings, + perUnitCostBasis, + threshold, expiresAfter, expiresAfterUnit, additionalProperties.toImmutable(), @@ -538,15 +538,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateByExternalIdResponse && id == other.id && currency == other.currency && threshold == other.threshold && amount == other.amount && perUnitCostBasis == other.perUnitCostBasis && invoiceSettings == other.invoiceSettings && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpCreateByExternalIdResponse && id == other.id && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, currency, threshold, amount, perUnitCostBasis, invoiceSettings, expiresAfter, expiresAfterUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditTopUpCreateByExternalIdResponse{id=$id, currency=$currency, threshold=$threshold, amount=$amount, perUnitCostBasis=$perUnitCostBasis, invoiceSettings=$invoiceSettings, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" + "CustomerCreditTopUpCreateByExternalIdResponse{id=$id, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt index 9a7e41a3..52cea74b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt @@ -190,13 +190,31 @@ constructor( * The number of days or months after which the top-up expires. If unspecified, it does * not expire. */ - fun expiresAfter(expiresAfter: Long) = apply { this.expiresAfter = expiresAfter } + fun expiresAfter(expiresAfter: Long?) = apply { this.expiresAfter = expiresAfter } + + /** + * The number of days or months after which the top-up expires. If unspecified, it does + * not expire. + */ + fun expiresAfter(expiresAfter: Long) = expiresAfter(expiresAfter as Long?) + + /** + * The number of days or months after which the top-up expires. If unspecified, it does + * not expire. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun expiresAfter(expiresAfter: Optional) = + expiresAfter(expiresAfter.orElse(null) as Long?) /** The unit of expires_after. */ - fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit) = apply { + fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit?) = apply { this.expiresAfterUnit = expiresAfterUnit } + /** The unit of expires_after. */ + fun expiresAfterUnit(expiresAfterUnit: Optional) = + expiresAfterUnit(expiresAfterUnit.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -308,13 +326,31 @@ constructor( * The number of days or months after which the top-up expires. If unspecified, it does not * expire. */ - fun expiresAfter(expiresAfter: Long) = apply { body.expiresAfter(expiresAfter) } + fun expiresAfter(expiresAfter: Long?) = apply { body.expiresAfter(expiresAfter) } + + /** + * The number of days or months after which the top-up expires. If unspecified, it does not + * expire. + */ + fun expiresAfter(expiresAfter: Long) = expiresAfter(expiresAfter as Long?) + + /** + * The number of days or months after which the top-up expires. If unspecified, it does not + * expire. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun expiresAfter(expiresAfter: Optional) = + expiresAfter(expiresAfter.orElse(null) as Long?) /** The unit of expires_after. */ - fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit) = apply { + fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit?) = apply { body.expiresAfterUnit(expiresAfterUnit) } + /** The unit of expires_after. */ + fun expiresAfterUnit(expiresAfterUnit: Optional) = + expiresAfterUnit(expiresAfterUnit.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -520,16 +556,34 @@ constructor( fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } /** An optional memo to display on the invoice. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String?) = apply { this.memo = memo } + + /** An optional memo to display on the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) /** * If true, new credit blocks created by this top-up will require that the corresponding * invoice is paid before they can be drawn down from. */ - fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = apply { + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean?) = apply { this.requireSuccessfulPayment = requireSuccessfulPayment } + /** + * If true, new credit blocks created by this top-up will require that the corresponding + * invoice is paid before they can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = + requireSuccessfulPayment(requireSuccessfulPayment as Boolean?) + + /** + * If true, new credit blocks created by this top-up will require that the corresponding + * invoice is paid before they can be drawn down from. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun requireSuccessfulPayment(requireSuccessfulPayment: Optional) = + requireSuccessfulPayment(requireSuccessfulPayment.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt index 6288a640..914d16d6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt @@ -23,21 +23,21 @@ class CustomerCreditTopUpCreateResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("threshold") - @ExcludeMissing - private val threshold: JsonField = JsonMissing.of(), - @JsonProperty("amount") + @JsonProperty("invoice_settings") @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), + private val invoiceSettings: JsonField = JsonMissing.of(), @JsonProperty("per_unit_cost_basis") @ExcludeMissing private val perUnitCostBasis: JsonField = JsonMissing.of(), - @JsonProperty("invoice_settings") + @JsonProperty("threshold") @ExcludeMissing - private val invoiceSettings: JsonField = JsonMissing.of(), + private val threshold: JsonField = JsonMissing.of(), @JsonProperty("expires_after") @ExcludeMissing private val expiresAfter: JsonField = JsonMissing.of(), @@ -49,27 +49,27 @@ private constructor( fun id(): String = id.getRequired("id") + /** The amount to increment when the threshold is reached. */ + fun amount(): String = amount.getRequired("amount") + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ fun currency(): String = currency.getRequired("currency") + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") + + /** How much, in the customer's currency, to charge for each unit. */ + fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ fun threshold(): String = threshold.getRequired("threshold") - /** The amount to increment when the threshold is reached. */ - fun amount(): String = amount.getRequired("amount") - - /** How much, in the customer's currency, to charge for each unit. */ - fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") - - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -83,27 +83,27 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The amount to increment when the threshold is reached. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** Settings for invoices generated by triggered top-ups. */ + @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings + + /** How much, in the customer's currency, to charge for each unit. */ + @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ @JsonProperty("threshold") @ExcludeMissing fun _threshold() = threshold - /** The amount to increment when the threshold is reached. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - /** How much, in the customer's currency, to charge for each unit. */ - @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis - - /** Settings for invoices generated by triggered top-ups. */ - @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -122,11 +122,11 @@ private constructor( fun validate(): CustomerCreditTopUpCreateResponse = apply { if (!validated) { id() - currency() - threshold() amount() - perUnitCostBasis() + currency() invoiceSettings().validate() + perUnitCostBasis() + threshold() expiresAfter() expiresAfterUnit() validated = true @@ -143,11 +143,11 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() - private var threshold: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var perUnitCostBasis: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var invoiceSettings: JsonField = JsonMissing.of() + private var perUnitCostBasis: JsonField = JsonMissing.of() + private var threshold: JsonField = JsonMissing.of() private var expiresAfter: JsonField = JsonMissing.of() private var expiresAfterUnit: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -156,11 +156,11 @@ private constructor( internal fun from(customerCreditTopUpCreateResponse: CustomerCreditTopUpCreateResponse) = apply { id = customerCreditTopUpCreateResponse.id - currency = customerCreditTopUpCreateResponse.currency - threshold = customerCreditTopUpCreateResponse.threshold amount = customerCreditTopUpCreateResponse.amount - perUnitCostBasis = customerCreditTopUpCreateResponse.perUnitCostBasis + currency = customerCreditTopUpCreateResponse.currency invoiceSettings = customerCreditTopUpCreateResponse.invoiceSettings + perUnitCostBasis = customerCreditTopUpCreateResponse.perUnitCostBasis + threshold = customerCreditTopUpCreateResponse.threshold expiresAfter = customerCreditTopUpCreateResponse.expiresAfter expiresAfterUnit = customerCreditTopUpCreateResponse.expiresAfterUnit additionalProperties = @@ -171,6 +171,12 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The amount to increment when the threshold is reached. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount to increment when the threshold is reached. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world * currency, it must match the customer's invoicing currency. @@ -183,23 +189,14 @@ private constructor( */ fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: JsonField) = apply { this.threshold = threshold } - - /** The amount to increment when the threshold is reached. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: InvoiceSettings) = + invoiceSettings(JsonField.of(invoiceSettings)) - /** The amount to increment when the threshold is reached. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: JsonField) = apply { + this.invoiceSettings = invoiceSettings + } /** How much, in the customer's currency, to charge for each unit. */ fun perUnitCostBasis(perUnitCostBasis: String) = @@ -210,14 +207,17 @@ private constructor( this.perUnitCostBasis = perUnitCostBasis } - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: InvoiceSettings) = - invoiceSettings(JsonField.of(invoiceSettings)) + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: JsonField) = apply { - this.invoiceSettings = invoiceSettings - } + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: JsonField) = apply { this.threshold = threshold } /** * The number of days or months after which the top-up expires. If unspecified, it does not @@ -262,11 +262,11 @@ private constructor( fun build(): CustomerCreditTopUpCreateResponse = CustomerCreditTopUpCreateResponse( id, - currency, - threshold, amount, - perUnitCostBasis, + currency, invoiceSettings, + perUnitCostBasis, + threshold, expiresAfter, expiresAfterUnit, additionalProperties.toImmutable(), @@ -536,15 +536,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateResponse && id == other.id && currency == other.currency && threshold == other.threshold && amount == other.amount && perUnitCostBasis == other.perUnitCostBasis && invoiceSettings == other.invoiceSettings && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpCreateResponse && id == other.id && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, currency, threshold, amount, perUnitCostBasis, invoiceSettings, expiresAfter, expiresAfterUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditTopUpCreateResponse{id=$id, currency=$currency, threshold=$threshold, amount=$amount, perUnitCostBasis=$perUnitCostBasis, invoiceSettings=$invoiceSettings, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" + "CustomerCreditTopUpCreateResponse{id=$id, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt index 3a5bcc39..15040e73 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt @@ -87,10 +87,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/CustomerCreditTopUpListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt index 425c642d..952e4837 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt @@ -23,21 +23,21 @@ class CustomerCreditTopUpListByExternalIdResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("threshold") - @ExcludeMissing - private val threshold: JsonField = JsonMissing.of(), - @JsonProperty("amount") + @JsonProperty("invoice_settings") @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), + private val invoiceSettings: JsonField = JsonMissing.of(), @JsonProperty("per_unit_cost_basis") @ExcludeMissing private val perUnitCostBasis: JsonField = JsonMissing.of(), - @JsonProperty("invoice_settings") + @JsonProperty("threshold") @ExcludeMissing - private val invoiceSettings: JsonField = JsonMissing.of(), + private val threshold: JsonField = JsonMissing.of(), @JsonProperty("expires_after") @ExcludeMissing private val expiresAfter: JsonField = JsonMissing.of(), @@ -49,27 +49,27 @@ private constructor( fun id(): String = id.getRequired("id") + /** The amount to increment when the threshold is reached. */ + fun amount(): String = amount.getRequired("amount") + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ fun currency(): String = currency.getRequired("currency") + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") + + /** How much, in the customer's currency, to charge for each unit. */ + fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ fun threshold(): String = threshold.getRequired("threshold") - /** The amount to increment when the threshold is reached. */ - fun amount(): String = amount.getRequired("amount") - - /** How much, in the customer's currency, to charge for each unit. */ - fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") - - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -83,27 +83,27 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The amount to increment when the threshold is reached. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** Settings for invoices generated by triggered top-ups. */ + @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings + + /** How much, in the customer's currency, to charge for each unit. */ + @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ @JsonProperty("threshold") @ExcludeMissing fun _threshold() = threshold - /** The amount to increment when the threshold is reached. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - /** How much, in the customer's currency, to charge for each unit. */ - @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis - - /** Settings for invoices generated by triggered top-ups. */ - @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -122,11 +122,11 @@ private constructor( fun validate(): CustomerCreditTopUpListByExternalIdResponse = apply { if (!validated) { id() - currency() - threshold() amount() - perUnitCostBasis() + currency() invoiceSettings().validate() + perUnitCostBasis() + threshold() expiresAfter() expiresAfterUnit() validated = true @@ -143,11 +143,11 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() - private var threshold: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var perUnitCostBasis: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var invoiceSettings: JsonField = JsonMissing.of() + private var perUnitCostBasis: JsonField = JsonMissing.of() + private var threshold: JsonField = JsonMissing.of() private var expiresAfter: JsonField = JsonMissing.of() private var expiresAfterUnit: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -157,11 +157,11 @@ private constructor( customerCreditTopUpListByExternalIdResponse: CustomerCreditTopUpListByExternalIdResponse ) = apply { id = customerCreditTopUpListByExternalIdResponse.id - currency = customerCreditTopUpListByExternalIdResponse.currency - threshold = customerCreditTopUpListByExternalIdResponse.threshold amount = customerCreditTopUpListByExternalIdResponse.amount - perUnitCostBasis = customerCreditTopUpListByExternalIdResponse.perUnitCostBasis + currency = customerCreditTopUpListByExternalIdResponse.currency invoiceSettings = customerCreditTopUpListByExternalIdResponse.invoiceSettings + perUnitCostBasis = customerCreditTopUpListByExternalIdResponse.perUnitCostBasis + threshold = customerCreditTopUpListByExternalIdResponse.threshold expiresAfter = customerCreditTopUpListByExternalIdResponse.expiresAfter expiresAfterUnit = customerCreditTopUpListByExternalIdResponse.expiresAfterUnit additionalProperties = @@ -172,6 +172,12 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The amount to increment when the threshold is reached. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount to increment when the threshold is reached. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world * currency, it must match the customer's invoicing currency. @@ -184,23 +190,14 @@ private constructor( */ fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: JsonField) = apply { this.threshold = threshold } - - /** The amount to increment when the threshold is reached. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: InvoiceSettings) = + invoiceSettings(JsonField.of(invoiceSettings)) - /** The amount to increment when the threshold is reached. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: JsonField) = apply { + this.invoiceSettings = invoiceSettings + } /** How much, in the customer's currency, to charge for each unit. */ fun perUnitCostBasis(perUnitCostBasis: String) = @@ -211,14 +208,17 @@ private constructor( this.perUnitCostBasis = perUnitCostBasis } - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: InvoiceSettings) = - invoiceSettings(JsonField.of(invoiceSettings)) + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: JsonField) = apply { - this.invoiceSettings = invoiceSettings - } + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: JsonField) = apply { this.threshold = threshold } /** * The number of days or months after which the top-up expires. If unspecified, it does not @@ -263,11 +263,11 @@ private constructor( fun build(): CustomerCreditTopUpListByExternalIdResponse = CustomerCreditTopUpListByExternalIdResponse( id, - currency, - threshold, amount, - perUnitCostBasis, + currency, invoiceSettings, + perUnitCostBasis, + threshold, expiresAfter, expiresAfterUnit, additionalProperties.toImmutable(), @@ -537,15 +537,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpListByExternalIdResponse && id == other.id && currency == other.currency && threshold == other.threshold && amount == other.amount && perUnitCostBasis == other.perUnitCostBasis && invoiceSettings == other.invoiceSettings && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpListByExternalIdResponse && id == other.id && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, currency, threshold, amount, perUnitCostBasis, invoiceSettings, expiresAfter, expiresAfterUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditTopUpListByExternalIdResponse{id=$id, currency=$currency, threshold=$threshold, amount=$amount, perUnitCostBasis=$perUnitCostBasis, invoiceSettings=$invoiceSettings, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" + "CustomerCreditTopUpListByExternalIdResponse{id=$id, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt index c306543d..463a12d2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.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/CustomerCreditTopUpListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt index 1d956ace..1822b168 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt @@ -23,21 +23,21 @@ class CustomerCreditTopUpListResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), - @JsonProperty("threshold") - @ExcludeMissing - private val threshold: JsonField = JsonMissing.of(), - @JsonProperty("amount") + @JsonProperty("invoice_settings") @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), + private val invoiceSettings: JsonField = JsonMissing.of(), @JsonProperty("per_unit_cost_basis") @ExcludeMissing private val perUnitCostBasis: JsonField = JsonMissing.of(), - @JsonProperty("invoice_settings") + @JsonProperty("threshold") @ExcludeMissing - private val invoiceSettings: JsonField = JsonMissing.of(), + private val threshold: JsonField = JsonMissing.of(), @JsonProperty("expires_after") @ExcludeMissing private val expiresAfter: JsonField = JsonMissing.of(), @@ -49,27 +49,27 @@ private constructor( fun id(): String = id.getRequired("id") + /** The amount to increment when the threshold is reached. */ + fun amount(): String = amount.getRequired("amount") + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ fun currency(): String = currency.getRequired("currency") + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") + + /** How much, in the customer's currency, to charge for each unit. */ + fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ fun threshold(): String = threshold.getRequired("threshold") - /** The amount to increment when the threshold is reached. */ - fun amount(): String = amount.getRequired("amount") - - /** How much, in the customer's currency, to charge for each unit. */ - fun perUnitCostBasis(): String = perUnitCostBasis.getRequired("per_unit_cost_basis") - - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(): InvoiceSettings = invoiceSettings.getRequired("invoice_settings") - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -83,27 +83,27 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The amount to increment when the threshold is reached. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, * it must match the customer's invoicing currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** Settings for invoices generated by triggered top-ups. */ + @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings + + /** How much, in the customer's currency, to charge for each unit. */ + @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis + /** * The threshold at which to trigger the top-up. If the balance is at or below this threshold, * the top-up will be triggered. */ @JsonProperty("threshold") @ExcludeMissing fun _threshold() = threshold - /** The amount to increment when the threshold is reached. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - /** How much, in the customer's currency, to charge for each unit. */ - @JsonProperty("per_unit_cost_basis") @ExcludeMissing fun _perUnitCostBasis() = perUnitCostBasis - - /** Settings for invoices generated by triggered top-ups. */ - @JsonProperty("invoice_settings") @ExcludeMissing fun _invoiceSettings() = invoiceSettings - /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. @@ -122,11 +122,11 @@ private constructor( fun validate(): CustomerCreditTopUpListResponse = apply { if (!validated) { id() - currency() - threshold() amount() - perUnitCostBasis() + currency() invoiceSettings().validate() + perUnitCostBasis() + threshold() expiresAfter() expiresAfterUnit() validated = true @@ -143,11 +143,11 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() - private var threshold: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var perUnitCostBasis: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var invoiceSettings: JsonField = JsonMissing.of() + private var perUnitCostBasis: JsonField = JsonMissing.of() + private var threshold: JsonField = JsonMissing.of() private var expiresAfter: JsonField = JsonMissing.of() private var expiresAfterUnit: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -156,11 +156,11 @@ private constructor( internal fun from(customerCreditTopUpListResponse: CustomerCreditTopUpListResponse) = apply { id = customerCreditTopUpListResponse.id - currency = customerCreditTopUpListResponse.currency - threshold = customerCreditTopUpListResponse.threshold amount = customerCreditTopUpListResponse.amount - perUnitCostBasis = customerCreditTopUpListResponse.perUnitCostBasis + currency = customerCreditTopUpListResponse.currency invoiceSettings = customerCreditTopUpListResponse.invoiceSettings + perUnitCostBasis = customerCreditTopUpListResponse.perUnitCostBasis + threshold = customerCreditTopUpListResponse.threshold expiresAfter = customerCreditTopUpListResponse.expiresAfter expiresAfterUnit = customerCreditTopUpListResponse.expiresAfterUnit additionalProperties = @@ -171,6 +171,12 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The amount to increment when the threshold is reached. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount to increment when the threshold is reached. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** * The currency or custom pricing unit to use for this top-up. If this is a real-world * currency, it must match the customer's invoicing currency. @@ -183,23 +189,14 @@ private constructor( */ fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - - /** - * The threshold at which to trigger the top-up. If the balance is at or below this - * threshold, the top-up will be triggered. - */ - fun threshold(threshold: JsonField) = apply { this.threshold = threshold } - - /** The amount to increment when the threshold is reached. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: InvoiceSettings) = + invoiceSettings(JsonField.of(invoiceSettings)) - /** The amount to increment when the threshold is reached. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(invoiceSettings: JsonField) = apply { + this.invoiceSettings = invoiceSettings + } /** How much, in the customer's currency, to charge for each unit. */ fun perUnitCostBasis(perUnitCostBasis: String) = @@ -210,14 +207,17 @@ private constructor( this.perUnitCostBasis = perUnitCostBasis } - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: InvoiceSettings) = - invoiceSettings(JsonField.of(invoiceSettings)) + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: String) = threshold(JsonField.of(threshold)) - /** Settings for invoices generated by triggered top-ups. */ - fun invoiceSettings(invoiceSettings: JsonField) = apply { - this.invoiceSettings = invoiceSettings - } + /** + * The threshold at which to trigger the top-up. If the balance is at or below this + * threshold, the top-up will be triggered. + */ + fun threshold(threshold: JsonField) = apply { this.threshold = threshold } /** * The number of days or months after which the top-up expires. If unspecified, it does not @@ -262,11 +262,11 @@ private constructor( fun build(): CustomerCreditTopUpListResponse = CustomerCreditTopUpListResponse( id, - currency, - threshold, amount, - perUnitCostBasis, + currency, invoiceSettings, + perUnitCostBasis, + threshold, expiresAfter, expiresAfterUnit, additionalProperties.toImmutable(), @@ -536,15 +536,15 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpListResponse && id == other.id && currency == other.currency && threshold == other.threshold && amount == other.amount && perUnitCostBasis == other.perUnitCostBasis && invoiceSettings == other.invoiceSettings && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpListResponse && id == other.id && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, currency, threshold, amount, perUnitCostBasis, invoiceSettings, expiresAfter, expiresAfterUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditTopUpListResponse{id=$id, currency=$currency, threshold=$threshold, amount=$amount, perUnitCostBasis=$perUnitCostBasis, invoiceSettings=$invoiceSettings, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" + "CustomerCreditTopUpListResponse{id=$id, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt index 0d859b20..376b6f2e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt @@ -109,22 +109,47 @@ constructor( additionalQueryParams = customerListParams.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 } + 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/CustomerUpdateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt index 5e90a3b7..2b6ff818 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt @@ -502,17 +502,28 @@ constructor( } fun accountingSyncConfiguration( - accountingSyncConfiguration: AccountingSyncConfiguration + accountingSyncConfiguration: AccountingSyncConfiguration? ) = apply { this.accountingSyncConfiguration = accountingSyncConfiguration } + fun accountingSyncConfiguration( + accountingSyncConfiguration: Optional + ) = accountingSyncConfiguration(accountingSyncConfiguration.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses * will be CC'd for customer communications. */ - fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails = additionalEmails.toMutableList() + fun additionalEmails(additionalEmails: List?) = apply { + this.additionalEmails = additionalEmails?.toMutableList() } + /** + * Additional email addresses for this customer. If populated, these email addresses + * will be CC'd for customer communications. + */ + fun additionalEmails(additionalEmails: Optional>) = + additionalEmails(additionalEmails.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses * will be CC'd for customer communications. @@ -527,42 +538,95 @@ constructor( * a saved payment method, if available. This parameter defaults to `True` when a * payment provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { + fun autoCollection(autoCollection: Boolean?) = apply { this.autoCollection = autoCollection } - fun billingAddress(billingAddress: BillingAddress) = apply { + /** + * Used to determine if invoices for this customer will automatically attempt to charge + * a saved payment method, if available. This parameter defaults to `True` when a + * payment provider is provided on customer creation. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Used to determine if invoices for this customer will automatically attempt to charge + * a saved payment method, if available. This parameter defaults to `True` when a + * payment provider is provided on customer creation. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) + + fun billingAddress(billingAddress: BillingAddress?) = apply { this.billingAddress = billingAddress } + fun billingAddress(billingAddress: Optional) = + billingAddress(billingAddress.orElse(null)) + + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set + * at creation time, will be set at subscription creation time. + */ + fun currency(currency: String?) = apply { this.currency = currency } + /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set * at creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** A valid customer email, to be used for invoicing and notifications. */ - fun email(email: String) = apply { this.email = email } + fun email(email: String?) = apply { this.email = email } + + /** A valid customer email, to be used for invoicing and notifications. */ + fun email(email: Optional) = email(email.orElse(null)) + + fun emailDelivery(emailDelivery: Boolean?) = apply { + this.emailDelivery = emailDelivery + } + + fun emailDelivery(emailDelivery: Boolean) = emailDelivery(emailDelivery as Boolean?) - fun emailDelivery(emailDelivery: Boolean) = apply { this.emailDelivery = emailDelivery } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun emailDelivery(emailDelivery: Optional) = + emailDelivery(emailDelivery.orElse(null) as Boolean?) /** * The external customer ID. This can only be set if empty and the customer has no past * or current subscriptions. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * The external customer ID. This can only be set if empty and the customer has no past + * or current subscriptions. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** The full name of the customer */ + fun name(name: String?) = apply { this.name = name } /** The full name of the customer */ - fun name(name: String) = apply { this.name = name } + fun name(name: Optional) = name(name.orElse(null)) /** * This is used for creating charges or invoices in an external system via Orb. When not @@ -572,30 +636,57 @@ constructor( * `bill.com`, `netsuite`), any product mappings must first be configured with the Orb * team. */ - fun paymentProvider(paymentProvider: PaymentProvider) = apply { + fun paymentProvider(paymentProvider: PaymentProvider?) = apply { this.paymentProvider = paymentProvider } + /** + * This is used for creating charges or invoices in an external system via Orb. When not + * in test mode: + * - the connection must first be configured in the Orb webapp. + * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, + * `bill.com`, `netsuite`), any product mappings must first be configured with the Orb + * team. + */ + fun paymentProvider(paymentProvider: Optional) = + paymentProvider(paymentProvider.orElse(null)) + /** * The ID of this customer in an external payments solution, such as Stripe. This is * used for creating charges or invoices in the external system via Orb. */ - fun paymentProviderId(paymentProviderId: String) = apply { + fun paymentProviderId(paymentProviderId: String?) = apply { this.paymentProviderId = paymentProviderId } - fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { + /** + * The ID of this customer in an external payments solution, such as Stripe. This is + * used for creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(paymentProviderId: Optional) = + paymentProviderId(paymentProviderId.orElse(null)) + + fun reportingConfiguration(reportingConfiguration: ReportingConfiguration?) = apply { this.reportingConfiguration = reportingConfiguration } - fun shippingAddress(shippingAddress: ShippingAddress) = apply { + fun reportingConfiguration(reportingConfiguration: Optional) = + reportingConfiguration(reportingConfiguration.orElse(null)) + + fun shippingAddress(shippingAddress: ShippingAddress?) = apply { this.shippingAddress = shippingAddress } - fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { + fun shippingAddress(shippingAddress: Optional) = + shippingAddress(shippingAddress.orElse(null)) + + fun taxConfiguration(taxConfiguration: TaxConfiguration?) = apply { this.taxConfiguration = taxConfiguration } + fun taxConfiguration(taxConfiguration: Optional) = + taxConfiguration(taxConfiguration.orElse(null)) + fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration ) = apply { @@ -715,7 +806,115 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { this.taxId = taxId } + fun taxId(taxId: TaxId?) = apply { this.taxId = taxId } + + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added + * to the headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (QuĆ©bec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószĆ”m) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna Å”tevilka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(taxId: Optional) = taxId(taxId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -804,19 +1003,30 @@ constructor( fun id(id: String) = apply { this.id = id } - fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration) = + fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration?) = apply { body.accountingSyncConfiguration(accountingSyncConfiguration) } + fun accountingSyncConfiguration( + accountingSyncConfiguration: Optional + ) = accountingSyncConfiguration(accountingSyncConfiguration.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses will be * CC'd for customer communications. */ - fun additionalEmails(additionalEmails: List) = apply { + fun additionalEmails(additionalEmails: List?) = apply { body.additionalEmails(additionalEmails) } + /** + * Additional email addresses for this customer. If populated, these email addresses will be + * CC'd for customer communications. + */ + fun additionalEmails(additionalEmails: Optional>) = + additionalEmails(additionalEmails.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses will be * CC'd for customer communications. @@ -830,40 +1040,91 @@ constructor( * saved payment method, if available. This parameter defaults to `True` when a payment * provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } + fun autoCollection(autoCollection: Boolean?) = apply { body.autoCollection(autoCollection) } + + /** + * Used to determine if invoices for this customer will automatically attempt to charge a + * saved payment method, if available. This parameter defaults to `True` when a payment + * provider is provided on customer creation. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Used to determine if invoices for this customer will automatically attempt to charge a + * saved payment method, if available. This parameter defaults to `True` when a payment + * provider is provided on customer creation. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) - fun billingAddress(billingAddress: BillingAddress) = apply { + fun billingAddress(billingAddress: BillingAddress?) = apply { body.billingAddress(billingAddress) } + fun billingAddress(billingAddress: Optional) = + billingAddress(billingAddress.orElse(null)) + + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set at + * creation time, will be set at subscription creation time. + */ + fun currency(currency: String?) = apply { body.currency(currency) } + /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set at * creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { body.currency(currency) } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** A valid customer email, to be used for invoicing and notifications. */ + fun email(email: String?) = apply { body.email(email) } /** A valid customer email, to be used for invoicing and notifications. */ - fun email(email: String) = apply { body.email(email) } + fun email(email: Optional) = email(email.orElse(null)) - fun emailDelivery(emailDelivery: Boolean) = apply { body.emailDelivery(emailDelivery) } + fun emailDelivery(emailDelivery: Boolean?) = apply { body.emailDelivery(emailDelivery) } + + fun emailDelivery(emailDelivery: Boolean) = emailDelivery(emailDelivery as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun emailDelivery(emailDelivery: Optional) = + emailDelivery(emailDelivery.orElse(null) as Boolean?) /** * The external customer ID. This can only be set if empty and the customer has no past or * current subscriptions. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } + /** + * The external customer ID. This can only be set if empty and the customer has no past or + * current subscriptions. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } + /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) /** The full name of the customer */ - fun name(name: String) = apply { body.name(name) } + fun name(name: String?) = apply { body.name(name) } + + /** The full name of the customer */ + fun name(name: Optional) = name(name.orElse(null)) /** * This is used for creating charges or invoices in an external system via Orb. When not in @@ -872,30 +1133,56 @@ constructor( * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, * `netsuite`), any product mappings must first be configured with the Orb team. */ - fun paymentProvider(paymentProvider: PaymentProvider) = apply { + fun paymentProvider(paymentProvider: PaymentProvider?) = apply { body.paymentProvider(paymentProvider) } + /** + * This is used for creating charges or invoices in an external system via Orb. When not in + * test mode: + * - the connection must first be configured in the Orb webapp. + * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, + * `netsuite`), any product mappings must first be configured with the Orb team. + */ + fun paymentProvider(paymentProvider: Optional) = + paymentProvider(paymentProvider.orElse(null)) + /** * The ID of this customer in an external payments solution, such as Stripe. This is used * for creating charges or invoices in the external system via Orb. */ - fun paymentProviderId(paymentProviderId: String) = apply { + fun paymentProviderId(paymentProviderId: String?) = apply { body.paymentProviderId(paymentProviderId) } - fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { + /** + * The ID of this customer in an external payments solution, such as Stripe. This is used + * for creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(paymentProviderId: Optional) = + paymentProviderId(paymentProviderId.orElse(null)) + + fun reportingConfiguration(reportingConfiguration: ReportingConfiguration?) = apply { body.reportingConfiguration(reportingConfiguration) } - fun shippingAddress(shippingAddress: ShippingAddress) = apply { + fun reportingConfiguration(reportingConfiguration: Optional) = + reportingConfiguration(reportingConfiguration.orElse(null)) + + fun shippingAddress(shippingAddress: ShippingAddress?) = apply { body.shippingAddress(shippingAddress) } - fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { + fun shippingAddress(shippingAddress: Optional) = + shippingAddress(shippingAddress.orElse(null)) + + fun taxConfiguration(taxConfiguration: TaxConfiguration?) = apply { body.taxConfiguration(taxConfiguration) } + fun taxConfiguration(taxConfiguration: Optional) = + taxConfiguration(taxConfiguration.orElse(null)) + fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration ) = apply { body.taxConfiguration(newAvalaraTaxConfiguration) } @@ -1011,7 +1298,115 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { body.taxId(taxId) } + fun taxId(taxId: TaxId?) = apply { body.taxId(taxId) } + + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added to + * the headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (QuĆ©bec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószĆ”m) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna Å”tevilka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(taxId: Optional) = taxId(taxId.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -1143,19 +1538,19 @@ constructor( class AccountingSyncConfiguration @JsonCreator private constructor( - @JsonProperty("excluded") private val excluded: Boolean?, @JsonProperty("accounting_providers") private val accountingProviders: List?, + @JsonProperty("excluded") private val excluded: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("excluded") fun excluded(): Optional = Optional.ofNullable(excluded) - @JsonProperty("accounting_providers") fun accountingProviders(): Optional> = Optional.ofNullable(accountingProviders) + @JsonProperty("excluded") fun excluded(): Optional = Optional.ofNullable(excluded) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1169,30 +1564,38 @@ constructor( class Builder { - private var excluded: Boolean? = null private var accountingProviders: MutableList? = null + private var excluded: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingSyncConfiguration: AccountingSyncConfiguration) = apply { - excluded = accountingSyncConfiguration.excluded accountingProviders = accountingSyncConfiguration.accountingProviders?.toMutableList() + excluded = accountingSyncConfiguration.excluded additionalProperties = accountingSyncConfiguration.additionalProperties.toMutableMap() } - fun excluded(excluded: Boolean) = apply { this.excluded = excluded } - - fun accountingProviders(accountingProviders: List) = apply { - this.accountingProviders = accountingProviders.toMutableList() + fun accountingProviders(accountingProviders: List?) = apply { + this.accountingProviders = accountingProviders?.toMutableList() } + fun accountingProviders(accountingProviders: Optional>) = + accountingProviders(accountingProviders.orElse(null)) + fun addAccountingProvider(accountingProvider: AccountingProvider) = apply { accountingProviders = (accountingProviders ?: mutableListOf()).apply { add(accountingProvider) } } + fun excluded(excluded: Boolean?) = apply { this.excluded = excluded } + + fun excluded(excluded: Boolean) = excluded(excluded as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun excluded(excluded: Optional) = excluded(excluded.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1214,8 +1617,8 @@ constructor( fun build(): AccountingSyncConfiguration = AccountingSyncConfiguration( - excluded, accountingProviders?.toImmutable(), + excluded, additionalProperties.toImmutable(), ) } @@ -1224,17 +1627,17 @@ constructor( class AccountingProvider @JsonCreator private constructor( - @JsonProperty("provider_type") private val providerType: String, @JsonProperty("external_provider_id") private val externalProviderId: String, + @JsonProperty("provider_type") private val providerType: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("provider_type") fun providerType(): String = providerType - @JsonProperty("external_provider_id") fun externalProviderId(): String = externalProviderId + @JsonProperty("provider_type") fun providerType(): String = providerType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1248,23 +1651,23 @@ constructor( class Builder { - private var providerType: String? = null private var externalProviderId: String? = null + private var providerType: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingProvider: AccountingProvider) = apply { - providerType = accountingProvider.providerType externalProviderId = accountingProvider.externalProviderId + providerType = accountingProvider.providerType additionalProperties = accountingProvider.additionalProperties.toMutableMap() } - fun providerType(providerType: String) = apply { this.providerType = providerType } - fun externalProviderId(externalProviderId: String) = apply { this.externalProviderId = externalProviderId } + fun providerType(providerType: String) = apply { this.providerType = providerType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1289,10 +1692,10 @@ constructor( fun build(): AccountingProvider = AccountingProvider( - checkNotNull(providerType) { "`providerType` is required but was not set" }, checkNotNull(externalProviderId) { "`externalProviderId` is required but was not set" }, + checkNotNull(providerType) { "`providerType` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -1302,17 +1705,17 @@ constructor( return true } - return /* spotless:off */ other is AccountingProvider && providerType == other.providerType && externalProviderId == other.externalProviderId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingProvider && externalProviderId == other.externalProviderId && providerType == other.providerType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(providerType, externalProviderId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalProviderId, providerType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingProvider{providerType=$providerType, externalProviderId=$externalProviderId, additionalProperties=$additionalProperties}" + "AccountingProvider{externalProviderId=$externalProviderId, providerType=$providerType, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1320,45 +1723,45 @@ constructor( return true } - return /* spotless:off */ other is AccountingSyncConfiguration && excluded == other.excluded && accountingProviders == other.accountingProviders && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingSyncConfiguration && accountingProviders == other.accountingProviders && excluded == other.excluded && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(excluded, accountingProviders, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountingProviders, excluded, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingSyncConfiguration{excluded=$excluded, accountingProviders=$accountingProviders, additionalProperties=$additionalProperties}" + "AccountingSyncConfiguration{accountingProviders=$accountingProviders, excluded=$excluded, additionalProperties=$additionalProperties}" } @NoAutoDetect class BillingAddress @JsonCreator private constructor( + @JsonProperty("city") private val city: String?, + @JsonProperty("country") private val country: String?, @JsonProperty("line1") private val line1: String?, @JsonProperty("line2") private val line2: String?, - @JsonProperty("city") private val city: String?, - @JsonProperty("state") private val state: String?, @JsonProperty("postal_code") private val postalCode: String?, - @JsonProperty("country") private val country: String?, + @JsonProperty("state") private val state: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) + @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) - @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) + @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) - @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) + @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) - @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) + @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) @JsonProperty("postal_code") fun postalCode(): Optional = Optional.ofNullable(postalCode) - @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) + @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) @JsonAnyGetter @ExcludeMissing @@ -1373,36 +1776,48 @@ constructor( class Builder { + private var city: String? = null + private var country: String? = null private var line1: String? = null private var line2: String? = null - private var city: String? = null - private var state: String? = null private var postalCode: String? = null - private var country: String? = null + private var state: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(billingAddress: BillingAddress) = apply { + city = billingAddress.city + country = billingAddress.country line1 = billingAddress.line1 line2 = billingAddress.line2 - city = billingAddress.city - state = billingAddress.state postalCode = billingAddress.postalCode - country = billingAddress.country + state = billingAddress.state additionalProperties = billingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = apply { this.line1 = line1 } + fun city(city: String?) = apply { this.city = city } + + fun city(city: Optional) = city(city.orElse(null)) + + fun country(country: String?) = apply { this.country = country } + + fun country(country: Optional) = country(country.orElse(null)) + + fun line1(line1: String?) = apply { this.line1 = line1 } + + fun line1(line1: Optional) = line1(line1.orElse(null)) - fun line2(line2: String) = apply { this.line2 = line2 } + fun line2(line2: String?) = apply { this.line2 = line2 } - fun city(city: String) = apply { this.city = city } + fun line2(line2: Optional) = line2(line2.orElse(null)) - fun state(state: String) = apply { this.state = state } + fun postalCode(postalCode: String?) = apply { this.postalCode = postalCode } - fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null)) - fun country(country: String) = apply { this.country = country } + fun state(state: String?) = apply { this.state = state } + + fun state(state: Optional) = state(state.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1425,12 +1840,12 @@ constructor( fun build(): BillingAddress = BillingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1440,17 +1855,17 @@ constructor( return true } - return /* spotless:off */ other is BillingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BillingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BillingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "BillingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } /** @@ -1683,28 +2098,28 @@ constructor( class ShippingAddress @JsonCreator private constructor( + @JsonProperty("city") private val city: String?, + @JsonProperty("country") private val country: String?, @JsonProperty("line1") private val line1: String?, @JsonProperty("line2") private val line2: String?, - @JsonProperty("city") private val city: String?, - @JsonProperty("state") private val state: String?, @JsonProperty("postal_code") private val postalCode: String?, - @JsonProperty("country") private val country: String?, + @JsonProperty("state") private val state: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) + @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) - @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) + @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) - @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) + @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) - @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) + @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) @JsonProperty("postal_code") fun postalCode(): Optional = Optional.ofNullable(postalCode) - @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) + @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) @JsonAnyGetter @ExcludeMissing @@ -1719,36 +2134,48 @@ constructor( class Builder { + private var city: String? = null + private var country: String? = null private var line1: String? = null private var line2: String? = null - private var city: String? = null - private var state: String? = null private var postalCode: String? = null - private var country: String? = null + private var state: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(shippingAddress: ShippingAddress) = apply { + city = shippingAddress.city + country = shippingAddress.country line1 = shippingAddress.line1 line2 = shippingAddress.line2 - city = shippingAddress.city - state = shippingAddress.state postalCode = shippingAddress.postalCode - country = shippingAddress.country + state = shippingAddress.state additionalProperties = shippingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = apply { this.line1 = line1 } + fun city(city: String?) = apply { this.city = city } - fun line2(line2: String) = apply { this.line2 = line2 } + fun city(city: Optional) = city(city.orElse(null)) - fun city(city: String) = apply { this.city = city } + fun country(country: String?) = apply { this.country = country } - fun state(state: String) = apply { this.state = state } + fun country(country: Optional) = country(country.orElse(null)) - fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + fun line1(line1: String?) = apply { this.line1 = line1 } - fun country(country: String) = apply { this.country = country } + fun line1(line1: Optional) = line1(line1.orElse(null)) + + fun line2(line2: String?) = apply { this.line2 = line2 } + + fun line2(line2: Optional) = line2(line2.orElse(null)) + + fun postalCode(postalCode: String?) = apply { this.postalCode = postalCode } + + fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null)) + + fun state(state: String?) = apply { this.state = state } + + fun state(state: Optional) = state(state.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1771,12 +2198,12 @@ constructor( fun build(): ShippingAddress = ShippingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1786,17 +2213,17 @@ constructor( return true } - return /* spotless:off */ other is ShippingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ShippingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ShippingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } @JsonDeserialize(using = TaxConfiguration.Deserializer::class) @@ -1972,10 +2399,13 @@ constructor( fun taxProvider(taxProvider: TaxProvider) = apply { this.taxProvider = taxProvider } - fun taxExemptionCode(taxExemptionCode: String) = apply { + fun taxExemptionCode(taxExemptionCode: String?) = apply { this.taxExemptionCode = taxExemptionCode } + fun taxExemptionCode(taxExemptionCode: Optional) = + taxExemptionCode(taxExemptionCode.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt index 38ce659d..f33b0e2f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt @@ -498,17 +498,28 @@ constructor( } fun accountingSyncConfiguration( - accountingSyncConfiguration: AccountingSyncConfiguration + accountingSyncConfiguration: AccountingSyncConfiguration? ) = apply { this.accountingSyncConfiguration = accountingSyncConfiguration } + fun accountingSyncConfiguration( + accountingSyncConfiguration: Optional + ) = accountingSyncConfiguration(accountingSyncConfiguration.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses * will be CC'd for customer communications. */ - fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails = additionalEmails.toMutableList() + fun additionalEmails(additionalEmails: List?) = apply { + this.additionalEmails = additionalEmails?.toMutableList() } + /** + * Additional email addresses for this customer. If populated, these email addresses + * will be CC'd for customer communications. + */ + fun additionalEmails(additionalEmails: Optional>) = + additionalEmails(additionalEmails.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses * will be CC'd for customer communications. @@ -523,42 +534,95 @@ constructor( * a saved payment method, if available. This parameter defaults to `True` when a * payment provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { + fun autoCollection(autoCollection: Boolean?) = apply { this.autoCollection = autoCollection } - fun billingAddress(billingAddress: BillingAddress) = apply { + /** + * Used to determine if invoices for this customer will automatically attempt to charge + * a saved payment method, if available. This parameter defaults to `True` when a + * payment provider is provided on customer creation. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Used to determine if invoices for this customer will automatically attempt to charge + * a saved payment method, if available. This parameter defaults to `True` when a + * payment provider is provided on customer creation. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) + + fun billingAddress(billingAddress: BillingAddress?) = apply { this.billingAddress = billingAddress } + fun billingAddress(billingAddress: Optional) = + billingAddress(billingAddress.orElse(null)) + + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set + * at creation time, will be set at subscription creation time. + */ + fun currency(currency: String?) = apply { this.currency = currency } + /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set * at creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) /** A valid customer email, to be used for invoicing and notifications. */ - fun email(email: String) = apply { this.email = email } + fun email(email: String?) = apply { this.email = email } + + /** A valid customer email, to be used for invoicing and notifications. */ + fun email(email: Optional) = email(email.orElse(null)) + + fun emailDelivery(emailDelivery: Boolean?) = apply { + this.emailDelivery = emailDelivery + } + + fun emailDelivery(emailDelivery: Boolean) = emailDelivery(emailDelivery as Boolean?) - fun emailDelivery(emailDelivery: Boolean) = apply { this.emailDelivery = emailDelivery } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun emailDelivery(emailDelivery: Optional) = + emailDelivery(emailDelivery.orElse(null) as Boolean?) /** * The external customer ID. This can only be set if empty and the customer has no past * or current subscriptions. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * The external customer ID. This can only be set if empty and the customer has no past + * or current subscriptions. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** The full name of the customer */ + fun name(name: String?) = apply { this.name = name } /** The full name of the customer */ - fun name(name: String) = apply { this.name = name } + fun name(name: Optional) = name(name.orElse(null)) /** * This is used for creating charges or invoices in an external system via Orb. When not @@ -568,30 +632,57 @@ constructor( * `bill.com`, `netsuite`), any product mappings must first be configured with the Orb * team. */ - fun paymentProvider(paymentProvider: PaymentProvider) = apply { + fun paymentProvider(paymentProvider: PaymentProvider?) = apply { this.paymentProvider = paymentProvider } + /** + * This is used for creating charges or invoices in an external system via Orb. When not + * in test mode: + * - the connection must first be configured in the Orb webapp. + * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, + * `bill.com`, `netsuite`), any product mappings must first be configured with the Orb + * team. + */ + fun paymentProvider(paymentProvider: Optional) = + paymentProvider(paymentProvider.orElse(null)) + /** * The ID of this customer in an external payments solution, such as Stripe. This is * used for creating charges or invoices in the external system via Orb. */ - fun paymentProviderId(paymentProviderId: String) = apply { + fun paymentProviderId(paymentProviderId: String?) = apply { this.paymentProviderId = paymentProviderId } - fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { + /** + * The ID of this customer in an external payments solution, such as Stripe. This is + * used for creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(paymentProviderId: Optional) = + paymentProviderId(paymentProviderId.orElse(null)) + + fun reportingConfiguration(reportingConfiguration: ReportingConfiguration?) = apply { this.reportingConfiguration = reportingConfiguration } - fun shippingAddress(shippingAddress: ShippingAddress) = apply { + fun reportingConfiguration(reportingConfiguration: Optional) = + reportingConfiguration(reportingConfiguration.orElse(null)) + + fun shippingAddress(shippingAddress: ShippingAddress?) = apply { this.shippingAddress = shippingAddress } - fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { + fun shippingAddress(shippingAddress: Optional) = + shippingAddress(shippingAddress.orElse(null)) + + fun taxConfiguration(taxConfiguration: TaxConfiguration?) = apply { this.taxConfiguration = taxConfiguration } + fun taxConfiguration(taxConfiguration: Optional) = + taxConfiguration(taxConfiguration.orElse(null)) + fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration ) = apply { @@ -711,7 +802,115 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { this.taxId = taxId } + fun taxId(taxId: TaxId?) = apply { this.taxId = taxId } + + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added + * to the headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (QuĆ©bec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószĆ”m) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna Å”tevilka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(taxId: Optional) = taxId(taxId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -797,19 +996,30 @@ constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } - fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration) = + fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration?) = apply { body.accountingSyncConfiguration(accountingSyncConfiguration) } + fun accountingSyncConfiguration( + accountingSyncConfiguration: Optional + ) = accountingSyncConfiguration(accountingSyncConfiguration.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses will be * CC'd for customer communications. */ - fun additionalEmails(additionalEmails: List) = apply { + fun additionalEmails(additionalEmails: List?) = apply { body.additionalEmails(additionalEmails) } + /** + * Additional email addresses for this customer. If populated, these email addresses will be + * CC'd for customer communications. + */ + fun additionalEmails(additionalEmails: Optional>) = + additionalEmails(additionalEmails.orElse(null)) + /** * Additional email addresses for this customer. If populated, these email addresses will be * CC'd for customer communications. @@ -823,40 +1033,91 @@ constructor( * saved payment method, if available. This parameter defaults to `True` when a payment * provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } + fun autoCollection(autoCollection: Boolean?) = apply { body.autoCollection(autoCollection) } + + /** + * Used to determine if invoices for this customer will automatically attempt to charge a + * saved payment method, if available. This parameter defaults to `True` when a payment + * provider is provided on customer creation. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Used to determine if invoices for this customer will automatically attempt to charge a + * saved payment method, if available. This parameter defaults to `True` when a payment + * provider is provided on customer creation. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) - fun billingAddress(billingAddress: BillingAddress) = apply { + fun billingAddress(billingAddress: BillingAddress?) = apply { body.billingAddress(billingAddress) } + fun billingAddress(billingAddress: Optional) = + billingAddress(billingAddress.orElse(null)) + + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set at + * creation time, will be set at subscription creation time. + */ + fun currency(currency: String?) = apply { body.currency(currency) } + /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set at * creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { body.currency(currency) } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** A valid customer email, to be used for invoicing and notifications. */ + fun email(email: String?) = apply { body.email(email) } /** A valid customer email, to be used for invoicing and notifications. */ - fun email(email: String) = apply { body.email(email) } + fun email(email: Optional) = email(email.orElse(null)) - fun emailDelivery(emailDelivery: Boolean) = apply { body.emailDelivery(emailDelivery) } + fun emailDelivery(emailDelivery: Boolean?) = apply { body.emailDelivery(emailDelivery) } + + fun emailDelivery(emailDelivery: Boolean) = emailDelivery(emailDelivery as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun emailDelivery(emailDelivery: Optional) = + emailDelivery(emailDelivery.orElse(null) as Boolean?) /** * The external customer ID. This can only be set if empty and the customer has no past or * current subscriptions. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } + /** + * The external customer ID. This can only be set if empty and the customer has no past or + * current subscriptions. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } + /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) /** The full name of the customer */ - fun name(name: String) = apply { body.name(name) } + fun name(name: String?) = apply { body.name(name) } + + /** The full name of the customer */ + fun name(name: Optional) = name(name.orElse(null)) /** * This is used for creating charges or invoices in an external system via Orb. When not in @@ -865,30 +1126,56 @@ constructor( * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, * `netsuite`), any product mappings must first be configured with the Orb team. */ - fun paymentProvider(paymentProvider: PaymentProvider) = apply { + fun paymentProvider(paymentProvider: PaymentProvider?) = apply { body.paymentProvider(paymentProvider) } + /** + * This is used for creating charges or invoices in an external system via Orb. When not in + * test mode: + * - the connection must first be configured in the Orb webapp. + * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, + * `netsuite`), any product mappings must first be configured with the Orb team. + */ + fun paymentProvider(paymentProvider: Optional) = + paymentProvider(paymentProvider.orElse(null)) + /** * The ID of this customer in an external payments solution, such as Stripe. This is used * for creating charges or invoices in the external system via Orb. */ - fun paymentProviderId(paymentProviderId: String) = apply { + fun paymentProviderId(paymentProviderId: String?) = apply { body.paymentProviderId(paymentProviderId) } - fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { + /** + * The ID of this customer in an external payments solution, such as Stripe. This is used + * for creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(paymentProviderId: Optional) = + paymentProviderId(paymentProviderId.orElse(null)) + + fun reportingConfiguration(reportingConfiguration: ReportingConfiguration?) = apply { body.reportingConfiguration(reportingConfiguration) } - fun shippingAddress(shippingAddress: ShippingAddress) = apply { + fun reportingConfiguration(reportingConfiguration: Optional) = + reportingConfiguration(reportingConfiguration.orElse(null)) + + fun shippingAddress(shippingAddress: ShippingAddress?) = apply { body.shippingAddress(shippingAddress) } - fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { + fun shippingAddress(shippingAddress: Optional) = + shippingAddress(shippingAddress.orElse(null)) + + fun taxConfiguration(taxConfiguration: TaxConfiguration?) = apply { body.taxConfiguration(taxConfiguration) } + fun taxConfiguration(taxConfiguration: Optional) = + taxConfiguration(taxConfiguration.orElse(null)) + fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration ) = apply { body.taxConfiguration(newAvalaraTaxConfiguration) } @@ -1004,7 +1291,115 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { body.taxId(taxId) } + fun taxId(taxId: TaxId?) = apply { body.taxId(taxId) } + + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added to + * the headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (QuĆ©bec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószĆ”m) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna Å”tevilka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(taxId: Optional) = taxId(taxId.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -1136,19 +1531,19 @@ constructor( class AccountingSyncConfiguration @JsonCreator private constructor( - @JsonProperty("excluded") private val excluded: Boolean?, @JsonProperty("accounting_providers") private val accountingProviders: List?, + @JsonProperty("excluded") private val excluded: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("excluded") fun excluded(): Optional = Optional.ofNullable(excluded) - @JsonProperty("accounting_providers") fun accountingProviders(): Optional> = Optional.ofNullable(accountingProviders) + @JsonProperty("excluded") fun excluded(): Optional = Optional.ofNullable(excluded) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1162,30 +1557,38 @@ constructor( class Builder { - private var excluded: Boolean? = null private var accountingProviders: MutableList? = null + private var excluded: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingSyncConfiguration: AccountingSyncConfiguration) = apply { - excluded = accountingSyncConfiguration.excluded accountingProviders = accountingSyncConfiguration.accountingProviders?.toMutableList() + excluded = accountingSyncConfiguration.excluded additionalProperties = accountingSyncConfiguration.additionalProperties.toMutableMap() } - fun excluded(excluded: Boolean) = apply { this.excluded = excluded } - - fun accountingProviders(accountingProviders: List) = apply { - this.accountingProviders = accountingProviders.toMutableList() + fun accountingProviders(accountingProviders: List?) = apply { + this.accountingProviders = accountingProviders?.toMutableList() } + fun accountingProviders(accountingProviders: Optional>) = + accountingProviders(accountingProviders.orElse(null)) + fun addAccountingProvider(accountingProvider: AccountingProvider) = apply { accountingProviders = (accountingProviders ?: mutableListOf()).apply { add(accountingProvider) } } + fun excluded(excluded: Boolean?) = apply { this.excluded = excluded } + + fun excluded(excluded: Boolean) = excluded(excluded as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun excluded(excluded: Optional) = excluded(excluded.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1207,8 +1610,8 @@ constructor( fun build(): AccountingSyncConfiguration = AccountingSyncConfiguration( - excluded, accountingProviders?.toImmutable(), + excluded, additionalProperties.toImmutable(), ) } @@ -1217,17 +1620,17 @@ constructor( class AccountingProvider @JsonCreator private constructor( - @JsonProperty("provider_type") private val providerType: String, @JsonProperty("external_provider_id") private val externalProviderId: String, + @JsonProperty("provider_type") private val providerType: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("provider_type") fun providerType(): String = providerType - @JsonProperty("external_provider_id") fun externalProviderId(): String = externalProviderId + @JsonProperty("provider_type") fun providerType(): String = providerType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1241,23 +1644,23 @@ constructor( class Builder { - private var providerType: String? = null private var externalProviderId: String? = null + private var providerType: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountingProvider: AccountingProvider) = apply { - providerType = accountingProvider.providerType externalProviderId = accountingProvider.externalProviderId + providerType = accountingProvider.providerType additionalProperties = accountingProvider.additionalProperties.toMutableMap() } - fun providerType(providerType: String) = apply { this.providerType = providerType } - fun externalProviderId(externalProviderId: String) = apply { this.externalProviderId = externalProviderId } + fun providerType(providerType: String) = apply { this.providerType = providerType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1282,10 +1685,10 @@ constructor( fun build(): AccountingProvider = AccountingProvider( - checkNotNull(providerType) { "`providerType` is required but was not set" }, checkNotNull(externalProviderId) { "`externalProviderId` is required but was not set" }, + checkNotNull(providerType) { "`providerType` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -1295,17 +1698,17 @@ constructor( return true } - return /* spotless:off */ other is AccountingProvider && providerType == other.providerType && externalProviderId == other.externalProviderId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingProvider && externalProviderId == other.externalProviderId && providerType == other.providerType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(providerType, externalProviderId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalProviderId, providerType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingProvider{providerType=$providerType, externalProviderId=$externalProviderId, additionalProperties=$additionalProperties}" + "AccountingProvider{externalProviderId=$externalProviderId, providerType=$providerType, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1313,45 +1716,45 @@ constructor( return true } - return /* spotless:off */ other is AccountingSyncConfiguration && excluded == other.excluded && accountingProviders == other.accountingProviders && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountingSyncConfiguration && accountingProviders == other.accountingProviders && excluded == other.excluded && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(excluded, accountingProviders, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountingProviders, excluded, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountingSyncConfiguration{excluded=$excluded, accountingProviders=$accountingProviders, additionalProperties=$additionalProperties}" + "AccountingSyncConfiguration{accountingProviders=$accountingProviders, excluded=$excluded, additionalProperties=$additionalProperties}" } @NoAutoDetect class BillingAddress @JsonCreator private constructor( + @JsonProperty("city") private val city: String?, + @JsonProperty("country") private val country: String?, @JsonProperty("line1") private val line1: String?, @JsonProperty("line2") private val line2: String?, - @JsonProperty("city") private val city: String?, - @JsonProperty("state") private val state: String?, @JsonProperty("postal_code") private val postalCode: String?, - @JsonProperty("country") private val country: String?, + @JsonProperty("state") private val state: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) + @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) - @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) + @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) - @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) + @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) - @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) + @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) @JsonProperty("postal_code") fun postalCode(): Optional = Optional.ofNullable(postalCode) - @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) + @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) @JsonAnyGetter @ExcludeMissing @@ -1366,36 +1769,48 @@ constructor( class Builder { + private var city: String? = null + private var country: String? = null private var line1: String? = null private var line2: String? = null - private var city: String? = null - private var state: String? = null private var postalCode: String? = null - private var country: String? = null + private var state: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(billingAddress: BillingAddress) = apply { + city = billingAddress.city + country = billingAddress.country line1 = billingAddress.line1 line2 = billingAddress.line2 - city = billingAddress.city - state = billingAddress.state postalCode = billingAddress.postalCode - country = billingAddress.country + state = billingAddress.state additionalProperties = billingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = apply { this.line1 = line1 } + fun city(city: String?) = apply { this.city = city } + + fun city(city: Optional) = city(city.orElse(null)) + + fun country(country: String?) = apply { this.country = country } + + fun country(country: Optional) = country(country.orElse(null)) + + fun line1(line1: String?) = apply { this.line1 = line1 } + + fun line1(line1: Optional) = line1(line1.orElse(null)) - fun line2(line2: String) = apply { this.line2 = line2 } + fun line2(line2: String?) = apply { this.line2 = line2 } - fun city(city: String) = apply { this.city = city } + fun line2(line2: Optional) = line2(line2.orElse(null)) - fun state(state: String) = apply { this.state = state } + fun postalCode(postalCode: String?) = apply { this.postalCode = postalCode } - fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null)) - fun country(country: String) = apply { this.country = country } + fun state(state: String?) = apply { this.state = state } + + fun state(state: Optional) = state(state.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1418,12 +1833,12 @@ constructor( fun build(): BillingAddress = BillingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1433,17 +1848,17 @@ constructor( return true } - return /* spotless:off */ other is BillingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BillingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BillingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "BillingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } /** @@ -1676,28 +2091,28 @@ constructor( class ShippingAddress @JsonCreator private constructor( + @JsonProperty("city") private val city: String?, + @JsonProperty("country") private val country: String?, @JsonProperty("line1") private val line1: String?, @JsonProperty("line2") private val line2: String?, - @JsonProperty("city") private val city: String?, - @JsonProperty("state") private val state: String?, @JsonProperty("postal_code") private val postalCode: String?, - @JsonProperty("country") private val country: String?, + @JsonProperty("state") private val state: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) + @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) - @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) + @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) - @JsonProperty("city") fun city(): Optional = Optional.ofNullable(city) + @JsonProperty("line1") fun line1(): Optional = Optional.ofNullable(line1) - @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) + @JsonProperty("line2") fun line2(): Optional = Optional.ofNullable(line2) @JsonProperty("postal_code") fun postalCode(): Optional = Optional.ofNullable(postalCode) - @JsonProperty("country") fun country(): Optional = Optional.ofNullable(country) + @JsonProperty("state") fun state(): Optional = Optional.ofNullable(state) @JsonAnyGetter @ExcludeMissing @@ -1712,36 +2127,48 @@ constructor( class Builder { + private var city: String? = null + private var country: String? = null private var line1: String? = null private var line2: String? = null - private var city: String? = null - private var state: String? = null private var postalCode: String? = null - private var country: String? = null + private var state: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(shippingAddress: ShippingAddress) = apply { + city = shippingAddress.city + country = shippingAddress.country line1 = shippingAddress.line1 line2 = shippingAddress.line2 - city = shippingAddress.city - state = shippingAddress.state postalCode = shippingAddress.postalCode - country = shippingAddress.country + state = shippingAddress.state additionalProperties = shippingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = apply { this.line1 = line1 } + fun city(city: String?) = apply { this.city = city } - fun line2(line2: String) = apply { this.line2 = line2 } + fun city(city: Optional) = city(city.orElse(null)) - fun city(city: String) = apply { this.city = city } + fun country(country: String?) = apply { this.country = country } - fun state(state: String) = apply { this.state = state } + fun country(country: Optional) = country(country.orElse(null)) - fun postalCode(postalCode: String) = apply { this.postalCode = postalCode } + fun line1(line1: String?) = apply { this.line1 = line1 } - fun country(country: String) = apply { this.country = country } + fun line1(line1: Optional) = line1(line1.orElse(null)) + + fun line2(line2: String?) = apply { this.line2 = line2 } + + fun line2(line2: Optional) = line2(line2.orElse(null)) + + fun postalCode(postalCode: String?) = apply { this.postalCode = postalCode } + + fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null)) + + fun state(state: String?) = apply { this.state = state } + + fun state(state: Optional) = state(state.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1764,12 +2191,12 @@ constructor( fun build(): ShippingAddress = ShippingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1779,17 +2206,17 @@ constructor( return true } - return /* spotless:off */ other is ShippingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ShippingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ShippingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } @JsonDeserialize(using = TaxConfiguration.Deserializer::class) @@ -1965,10 +2392,13 @@ constructor( fun taxProvider(taxProvider: TaxProvider) = apply { this.taxProvider = taxProvider } - fun taxExemptionCode(taxExemptionCode: String) = apply { + fun taxExemptionCode(taxExemptionCode: String?) = apply { this.taxExemptionCode = taxExemptionCode } + fun taxExemptionCode(taxExemptionCode: Optional) = + taxExemptionCode(taxExemptionCode.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt index aeefba84..644d2fbc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt @@ -24,34 +24,33 @@ import java.util.Optional class DimensionalPriceGroup @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("external_dimensional_price_group_id") + @JsonProperty("billable_metric_id") @ExcludeMissing - private val externalDimensionalPriceGroupId: JsonField = JsonMissing.of(), + private val billableMetricId: JsonField = JsonMissing.of(), @JsonProperty("dimensions") @ExcludeMissing private val dimensions: JsonField> = JsonMissing.of(), - @JsonProperty("billable_metric_id") + @JsonProperty("external_dimensional_price_group_id") @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), + private val externalDimensionalPriceGroupId: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + /** - * 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`. + * The billable metric associated with this dimensional price group. All prices associated with + * this dimensional price group will be computed using this billable metric. */ - fun metadata(): Metadata = metadata.getRequired("metadata") - - fun id(): String = id.getRequired("id") + fun billableMetricId(): String = billableMetricId.getRequired("billable_metric_id") - /** The name of the dimensional price group */ - fun name(): String = name.getRequired("name") + /** The dimensions that this dimensional price group is defined over */ + fun dimensions(): List = dimensions.getRequired("dimensions") /** An alias for the dimensional price group */ fun externalDimensionalPriceGroupId(): Optional = @@ -59,40 +58,41 @@ private constructor( externalDimensionalPriceGroupId.getNullable("external_dimensional_price_group_id") ) - /** The dimensions that this dimensional price group is defined over */ - fun dimensions(): List = dimensions.getRequired("dimensions") - - /** - * The billable metric associated with this dimensional price group. All prices associated with - * this dimensional price group will be computed using this billable metric. - */ - fun billableMetricId(): String = billableMetricId.getRequired("billable_metric_id") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The name of the dimensional price group */ + fun name(): String = name.getRequired("name") @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The name of the dimensional price group */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + /** + * The billable metric associated with this dimensional price group. All prices associated with + * this dimensional price group will be computed using this billable metric. + */ + @JsonProperty("billable_metric_id") @ExcludeMissing fun _billableMetricId() = billableMetricId + + /** The dimensions that this dimensional price group is defined over */ + @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions /** An alias for the dimensional price group */ @JsonProperty("external_dimensional_price_group_id") @ExcludeMissing fun _externalDimensionalPriceGroupId() = externalDimensionalPriceGroupId - /** The dimensions that this dimensional price group is defined over */ - @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions - /** - * The billable metric associated with this dimensional price group. All prices associated with - * this dimensional price group will be computed using this billable metric. + * 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("billable_metric_id") @ExcludeMissing fun _billableMetricId() = billableMetricId + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The name of the dimensional price group */ + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonAnyGetter @ExcludeMissing @@ -102,12 +102,12 @@ private constructor( fun validate(): DimensionalPriceGroup = apply { if (!validated) { - metadata().validate() id() - name() - externalDimensionalPriceGroupId() - dimensions() billableMetricId() + dimensions() + externalDimensionalPriceGroupId() + metadata().validate() + name() validated = true } } @@ -121,48 +121,49 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalDimensionalPriceGroupId: JsonField = JsonMissing.of() - private var dimensions: JsonField> = JsonMissing.of() private var billableMetricId: JsonField = JsonMissing.of() + private var dimensions: JsonField> = JsonMissing.of() + private var externalDimensionalPriceGroupId: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(dimensionalPriceGroup: DimensionalPriceGroup) = apply { - metadata = dimensionalPriceGroup.metadata id = dimensionalPriceGroup.id - name = dimensionalPriceGroup.name - externalDimensionalPriceGroupId = dimensionalPriceGroup.externalDimensionalPriceGroupId - dimensions = dimensionalPriceGroup.dimensions billableMetricId = dimensionalPriceGroup.billableMetricId + dimensions = dimensionalPriceGroup.dimensions + externalDimensionalPriceGroupId = dimensionalPriceGroup.externalDimensionalPriceGroupId + metadata = dimensionalPriceGroup.metadata + name = dimensionalPriceGroup.name additionalProperties = dimensionalPriceGroup.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + /** - * 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`. + * The billable metric associated with this dimensional price group. All prices associated + * with this dimensional price group will be computed using this billable metric. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun billableMetricId(billableMetricId: String) = + billableMetricId(JsonField.of(billableMetricId)) /** - * 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`. + * The billable metric associated with this dimensional price group. All prices associated + * with this dimensional price group will be computed using this billable metric. */ - 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 billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - /** The name of the dimensional price group */ - fun name(name: String) = name(JsonField.of(name)) + /** The dimensions that this dimensional price group is defined over */ + fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - /** The name of the dimensional price group */ - fun name(name: JsonField) = apply { this.name = name } + /** The dimensions that this dimensional price group is defined over */ + fun dimensions(dimensions: JsonField>) = apply { this.dimensions = dimensions } /** An alias for the dimensional price group */ fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String) = @@ -174,26 +175,25 @@ private constructor( this.externalDimensionalPriceGroupId = externalDimensionalPriceGroupId } - /** The dimensions that this dimensional price group is defined over */ - fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - - /** The dimensions that this dimensional price group is defined over */ - fun dimensions(dimensions: JsonField>) = apply { this.dimensions = dimensions } - /** - * The billable metric associated with this dimensional price group. All prices associated - * with this dimensional price group will be computed using this billable metric. + * 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 billableMetricId(billableMetricId: String) = - billableMetricId(JsonField.of(billableMetricId)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * The billable metric associated with this dimensional price group. All prices associated - * with this dimensional price group will be computed using this billable metric. + * 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 billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The name of the dimensional price group */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the dimensional price group */ + fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -216,12 +216,12 @@ private constructor( fun build(): DimensionalPriceGroup = DimensionalPriceGroup( - metadata, id, - name, - externalDimensionalPriceGroupId, - dimensions.map { it.toImmutable() }, billableMetricId, + dimensions.map { it.toImmutable() }, + externalDimensionalPriceGroupId, + metadata, + name, additionalProperties.toImmutable(), ) } @@ -311,15 +311,15 @@ private constructor( return true } - return /* spotless:off */ other is DimensionalPriceGroup && metadata == other.metadata && id == other.id && name == other.name && externalDimensionalPriceGroupId == other.externalDimensionalPriceGroupId && dimensions == other.dimensions && billableMetricId == other.billableMetricId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is DimensionalPriceGroup && id == other.id && billableMetricId == other.billableMetricId && dimensions == other.dimensions && externalDimensionalPriceGroupId == other.externalDimensionalPriceGroupId && metadata == other.metadata && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalDimensionalPriceGroupId, dimensions, billableMetricId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetricId, dimensions, externalDimensionalPriceGroupId, metadata, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "DimensionalPriceGroup{metadata=$metadata, id=$id, name=$name, externalDimensionalPriceGroupId=$externalDimensionalPriceGroupId, dimensions=$dimensions, billableMetricId=$billableMetricId, additionalProperties=$additionalProperties}" + "DimensionalPriceGroup{id=$id, billableMetricId=$billableMetricId, dimensions=$dimensions, externalDimensionalPriceGroupId=$externalDimensionalPriceGroupId, metadata=$metadata, name=$name, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt index 2905fbdd..fd5c7e13 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt @@ -132,16 +132,26 @@ constructor( fun name(name: String) = apply { this.name = name } - fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String) = apply { + fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String?) = apply { this.externalDimensionalPriceGroupId = externalDimensionalPriceGroupId } + fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: Optional) = + externalDimensionalPriceGroupId(externalDimensionalPriceGroupId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -230,16 +240,26 @@ constructor( fun name(name: String) = apply { body.name(name) } - fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String) = apply { + fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String?) = apply { body.externalDimensionalPriceGroupId(externalDimensionalPriceGroupId) } + fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: Optional) = + externalDimensionalPriceGroupId(externalDimensionalPriceGroupId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } + /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt index 29ebd53c..49453030 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt @@ -69,10 +69,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/Discount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Discount.kt index b2c048d5..2ce7d025 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Discount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Discount.kt @@ -209,24 +209,22 @@ private constructor( class UsageDiscount @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("discount_type") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can * be a subset of prices. @@ -234,7 +232,7 @@ private constructor( fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + fun discountType(): DiscountType = discountType.getRequired("discount_type") /** * Only available if discount_type is `usage`. Number of usage units that this discount is @@ -242,7 +240,7 @@ private constructor( */ fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can @@ -252,7 +250,7 @@ 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 `usage`. Number of usage units that this discount is @@ -260,6 +258,8 @@ private constructor( */ @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -268,10 +268,10 @@ private constructor( fun validate(): UsageDiscount = apply { if (!validated) { - discountType() appliesToPriceIds() - reason() + discountType() usageDiscount() + reason() validated = true } } @@ -285,27 +285,21 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var reason: JsonField = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() + private var reason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscount: UsageDiscount) = apply { - discountType = usageDiscount.discountType appliesToPriceIds = usageDiscount.appliesToPriceIds - reason = usageDiscount.reason + discountType = usageDiscount.discountType this.usageDiscount = usageDiscount.usageDiscount + reason = usageDiscount.reason additionalProperties = usageDiscount.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this * can be a subset of prices. @@ -321,9 +315,11 @@ 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 `usage`. Number of usage units that this discount @@ -339,6 +335,10 @@ private constructor( this.usageDiscount = usageDiscount } + fun reason(reason: String) = reason(JsonField.of(reason)) + + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -360,10 +360,10 @@ private constructor( fun build(): UsageDiscount = UsageDiscount( - discountType, appliesToPriceIds.map { it.toImmutable() }, - reason, + discountType, usageDiscount, + reason, additionalProperties.toImmutable(), ) } @@ -424,16 +424,16 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscount && discountType == other.discountType && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscount && appliesToPriceIds == other.appliesToPriceIds && discountType == other.discountType && usageDiscount == other.usageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, appliesToPriceIds, reason, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, discountType, usageDiscount, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscount{discountType=$discountType, appliesToPriceIds=$appliesToPriceIds, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscount{appliesToPriceIds=$appliesToPriceIds, discountType=$discountType, usageDiscount=$usageDiscount, reason=$reason, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt index 3976869a..2393d25a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt @@ -31,18 +31,21 @@ import java.util.Optional class EvaluatePriceGroup @JsonCreator private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("grouping_values") @ExcludeMissing private val groupingValues: JsonField> = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The price's output for the group */ + fun amount(): String = amount.getRequired("amount") + /** The values for the group in the order specified by `grouping_keys` */ fun groupingValues(): List = groupingValues.getRequired("grouping_values") @@ -50,7 +53,7 @@ private constructor( fun quantity(): Double = quantity.getRequired("quantity") /** The price's output for the group */ - fun amount(): String = amount.getRequired("amount") + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** The values for the group in the order specified by `grouping_keys` */ @JsonProperty("grouping_values") @ExcludeMissing fun _groupingValues() = groupingValues @@ -58,9 +61,6 @@ private constructor( /** The price's usage quantity for the group */ @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - /** The price's output for the group */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -69,9 +69,9 @@ private constructor( fun validate(): EvaluatePriceGroup = apply { if (!validated) { + amount() groupingValues() quantity() - amount() validated = true } } @@ -85,19 +85,25 @@ private constructor( class Builder { + private var amount: JsonField = JsonMissing.of() private var groupingValues: JsonField> = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(evaluatePriceGroup: EvaluatePriceGroup) = apply { + amount = evaluatePriceGroup.amount groupingValues = evaluatePriceGroup.groupingValues quantity = evaluatePriceGroup.quantity - amount = evaluatePriceGroup.amount additionalProperties = evaluatePriceGroup.additionalProperties.toMutableMap() } + /** The price's output for the group */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The price's output for the group */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The values for the group in the order specified by `grouping_keys` */ fun groupingValues(groupingValues: List) = groupingValues(JsonField.of(groupingValues)) @@ -113,12 +119,6 @@ private constructor( /** The price's usage quantity for the group */ fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - /** The price's output for the group */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The price's output for the group */ - fun amount(amount: JsonField) = apply { this.amount = amount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -140,9 +140,9 @@ private constructor( fun build(): EvaluatePriceGroup = EvaluatePriceGroup( + amount, groupingValues.map { it.toImmutable() }, quantity, - amount, additionalProperties.toImmutable(), ) } @@ -280,15 +280,15 @@ private constructor( return true } - return /* spotless:off */ other is EvaluatePriceGroup && groupingValues == other.groupingValues && quantity == other.quantity && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EvaluatePriceGroup && amount == other.amount && groupingValues == other.groupingValues && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(groupingValues, quantity, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, groupingValues, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EvaluatePriceGroup{groupingValues=$groupingValues, quantity=$quantity, amount=$amount, additionalProperties=$additionalProperties}" + "EvaluatePriceGroup{amount=$amount, groupingValues=$groupingValues, quantity=$quantity, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt index 5b06708a..5fe6c161 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt @@ -28,30 +28,30 @@ class EventBackfillCloseResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("status") + @JsonProperty("close_time") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), + private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_start") - @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") + @JsonProperty("customer_id") @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), + private val customerId: JsonField = JsonMissing.of(), @JsonProperty("events_ingested") @ExcludeMissing private val eventsIngested: JsonField = JsonMissing.of(), - @JsonProperty("close_time") - @ExcludeMissing - private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("reverted_at") @ExcludeMissing private val revertedAt: JsonField = JsonMissing.of(), - @JsonProperty("customer_id") + @JsonProperty("status") @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), + private val status: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_end") + @ExcludeMissing + private val timeframeEnd: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_start") + @ExcludeMissing + private val timeframeStart: JsonField = JsonMissing.of(), @JsonProperty("deprecation_filter") @ExcludeMissing private val deprecationFilter: JsonField = JsonMissing.of(), @@ -60,18 +60,6 @@ private constructor( fun id(): String = id.getRequired("id") - /** The status of the backfill. */ - fun status(): Status = status.getRequired("status") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") - - /** The number of events ingested in this backfill. */ - fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. @@ -79,9 +67,7 @@ private constructor( fun closeTime(): Optional = Optional.ofNullable(closeTime.getNullable("close_time")) - /** The time at which this backfill was reverted. */ - fun revertedAt(): Optional = - Optional.ofNullable(revertedAt.getNullable("reverted_at")) + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -89,6 +75,20 @@ private constructor( */ fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + /** The number of events ingested in this backfill. */ + fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") + + /** The time at which this backfill was reverted. */ + fun revertedAt(): Optional = + Optional.ofNullable(revertedAt.getNullable("reverted_at")) + + /** The status of the backfill. */ + fun status(): Status = status.getRequired("status") + + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -98,26 +98,13 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The status of the backfill. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - /** The number of events ingested in this backfill. */ - @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. */ @JsonProperty("close_time") @ExcludeMissing fun _closeTime() = closeTime - /** The time at which this backfill was reverted. */ - @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -125,6 +112,19 @@ private constructor( */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + /** The number of events ingested in this backfill. */ + @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested + + /** The time at which this backfill was reverted. */ + @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + + /** The status of the backfill. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -140,14 +140,14 @@ private constructor( fun validate(): EventBackfillCloseResponse = apply { if (!validated) { id() - status() + closeTime() createdAt() - timeframeStart() - timeframeEnd() + customerId() eventsIngested() - closeTime() revertedAt() - customerId() + status() + timeframeEnd() + timeframeStart() deprecationFilter() validated = true } @@ -163,28 +163,28 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var closeTime: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() - private var timeframeEnd: JsonField = JsonMissing.of() + private var customerId: JsonField = JsonMissing.of() private var eventsIngested: JsonField = JsonMissing.of() - private var closeTime: JsonField = JsonMissing.of() private var revertedAt: JsonField = JsonMissing.of() - private var customerId: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var deprecationFilter: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillCloseResponse: EventBackfillCloseResponse) = apply { id = eventBackfillCloseResponse.id - status = eventBackfillCloseResponse.status + closeTime = eventBackfillCloseResponse.closeTime createdAt = eventBackfillCloseResponse.createdAt - timeframeStart = eventBackfillCloseResponse.timeframeStart - timeframeEnd = eventBackfillCloseResponse.timeframeEnd + customerId = eventBackfillCloseResponse.customerId eventsIngested = eventBackfillCloseResponse.eventsIngested - closeTime = eventBackfillCloseResponse.closeTime revertedAt = eventBackfillCloseResponse.revertedAt - customerId = eventBackfillCloseResponse.customerId + status = eventBackfillCloseResponse.status + timeframeEnd = eventBackfillCloseResponse.timeframeEnd + timeframeStart = eventBackfillCloseResponse.timeframeStart deprecationFilter = eventBackfillCloseResponse.deprecationFilter additionalProperties = eventBackfillCloseResponse.additionalProperties.toMutableMap() } @@ -193,37 +193,6 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** The status of the backfill. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** The status of the backfill. */ - fun status(status: JsonField) = apply { this.status = status } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) - - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } - - fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: JsonField) = apply { - this.eventsIngested = eventsIngested - } - /** * If in the future, the time at which the backfill will automatically close. If in the * past, the time at which the backfill was closed. @@ -236,13 +205,9 @@ private constructor( */ fun closeTime(closeTime: JsonField) = apply { this.closeTime = closeTime } - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: JsonField) = apply { - this.revertedAt = revertedAt - } + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -256,6 +221,41 @@ private constructor( */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) + + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: JsonField) = apply { + this.eventsIngested = eventsIngested + } + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: JsonField) = apply { + this.revertedAt = revertedAt + } + + /** The status of the backfill. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of the backfill. */ + fun status(status: JsonField) = apply { this.status = status } + + fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) + + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } + + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) + + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } + /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to @@ -295,14 +295,14 @@ private constructor( fun build(): EventBackfillCloseResponse = EventBackfillCloseResponse( id, - status, + closeTime, createdAt, - timeframeStart, - timeframeEnd, + customerId, eventsIngested, - closeTime, revertedAt, - customerId, + status, + timeframeEnd, + timeframeStart, deprecationFilter, additionalProperties.toImmutable(), ) @@ -382,15 +382,15 @@ private constructor( return true } - return /* spotless:off */ other is EventBackfillCloseResponse && id == other.id && status == other.status && createdAt == other.createdAt && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && eventsIngested == other.eventsIngested && closeTime == other.closeTime && revertedAt == other.revertedAt && customerId == other.customerId && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillCloseResponse && id == other.id && closeTime == other.closeTime && createdAt == other.createdAt && customerId == other.customerId && eventsIngested == other.eventsIngested && revertedAt == other.revertedAt && status == other.status && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, status, createdAt, timeframeStart, timeframeEnd, eventsIngested, closeTime, revertedAt, customerId, deprecationFilter, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, closeTime, createdAt, customerId, eventsIngested, revertedAt, status, timeframeEnd, timeframeStart, deprecationFilter, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EventBackfillCloseResponse{id=$id, status=$status, createdAt=$createdAt, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, eventsIngested=$eventsIngested, closeTime=$closeTime, revertedAt=$revertedAt, customerId=$customerId, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" + "EventBackfillCloseResponse{id=$id, closeTime=$closeTime, createdAt=$createdAt, customerId=$customerId, eventsIngested=$eventsIngested, revertedAt=$revertedAt, status=$status, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt index 7dcddd76..40e0aa63 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt @@ -180,39 +180,82 @@ constructor( * will automatically begin reflecting throughout Orb at the close time. If not * specified, it will default to 1 day after the creation of the backfill. */ - fun closeTime(closeTime: OffsetDateTime) = apply { this.closeTime = closeTime } + fun closeTime(closeTime: OffsetDateTime?) = apply { this.closeTime = closeTime } + + /** + * The time at which no more events will be accepted for this backfill. The backfill + * will automatically begin reflecting throughout Orb at the close time. If not + * specified, it will default to 1 day after the creation of the backfill. + */ + fun closeTime(closeTime: Optional) = closeTime(closeTime.orElse(null)) + + /** + * The Orb-generated ID of the customer to which this backfill is scoped. Omitting this + * field will scope the backfill to all customers. + */ + fun customerId(customerId: String?) = apply { this.customerId = customerId } /** * The Orb-generated ID of the customer to which this backfill is scoped. Omitting this * field will scope the backfill to all customers. */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate */ - fun deprecationFilter(deprecationFilter: String) = apply { + fun deprecationFilter(deprecationFilter: String?) = apply { this.deprecationFilter = deprecationFilter } + /** + * A boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties) + * used to filter the set of events to deprecate + */ + fun deprecationFilter(deprecationFilter: Optional) = + deprecationFilter(deprecationFilter.orElse(null)) + /** * The external customer ID of the customer to which this backfill is scoped. Omitting * this field will scope the backfill to all customers. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * The external customer ID of the customer to which this backfill is scoped. Omitting + * this field will scope the backfill to all customers. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + /** * If true, replaces all existing events in the timeframe with the newly ingested * events. If false, adds the newly ingested events to the existing events. */ - fun replaceExistingEvents(replaceExistingEvents: Boolean) = apply { + fun replaceExistingEvents(replaceExistingEvents: Boolean?) = apply { this.replaceExistingEvents = replaceExistingEvents } + /** + * If true, replaces all existing events in the timeframe with the newly ingested + * events. If false, adds the newly ingested events to the existing events. + */ + fun replaceExistingEvents(replaceExistingEvents: Boolean) = + replaceExistingEvents(replaceExistingEvents as Boolean?) + + /** + * If true, replaces all existing events in the timeframe with the newly ingested + * events. If false, adds the newly ingested events to the existing events. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun replaceExistingEvents(replaceExistingEvents: Optional) = + replaceExistingEvents(replaceExistingEvents.orElse(null) as Boolean?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -297,39 +340,82 @@ constructor( * automatically begin reflecting throughout Orb at the close time. If not specified, it * will default to 1 day after the creation of the backfill. */ - fun closeTime(closeTime: OffsetDateTime) = apply { body.closeTime(closeTime) } + fun closeTime(closeTime: OffsetDateTime?) = apply { body.closeTime(closeTime) } + + /** + * The time at which no more events will be accepted for this backfill. The backfill will + * automatically begin reflecting throughout Orb at the close time. If not specified, it + * will default to 1 day after the creation of the backfill. + */ + fun closeTime(closeTime: Optional) = closeTime(closeTime.orElse(null)) + + /** + * The Orb-generated ID of the customer to which this backfill is scoped. Omitting this + * field will scope the backfill to all customers. + */ + fun customerId(customerId: String?) = apply { body.customerId(customerId) } /** * The Orb-generated ID of the customer to which this backfill is scoped. Omitting this * field will scope the backfill to all customers. */ - fun customerId(customerId: String) = apply { body.customerId(customerId) } + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to * filter the set of events to deprecate */ - fun deprecationFilter(deprecationFilter: String) = apply { + fun deprecationFilter(deprecationFilter: String?) = apply { body.deprecationFilter(deprecationFilter) } + /** + * A boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to + * filter the set of events to deprecate + */ + fun deprecationFilter(deprecationFilter: Optional) = + deprecationFilter(deprecationFilter.orElse(null)) + /** * The external customer ID of the customer to which this backfill is scoped. Omitting this * field will scope the backfill to all customers. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } + /** + * The external customer ID of the customer to which this backfill is scoped. Omitting this + * field will scope the backfill to all customers. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + /** * If true, replaces all existing events in the timeframe with the newly ingested events. If * false, adds the newly ingested events to the existing events. */ - fun replaceExistingEvents(replaceExistingEvents: Boolean) = apply { + fun replaceExistingEvents(replaceExistingEvents: Boolean?) = apply { body.replaceExistingEvents(replaceExistingEvents) } + /** + * If true, replaces all existing events in the timeframe with the newly ingested events. If + * false, adds the newly ingested events to the existing events. + */ + fun replaceExistingEvents(replaceExistingEvents: Boolean) = + replaceExistingEvents(replaceExistingEvents as Boolean?) + + /** + * If true, replaces all existing events in the timeframe with the newly ingested events. If + * false, adds the newly ingested events to the existing events. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun replaceExistingEvents(replaceExistingEvents: Optional) = + replaceExistingEvents(replaceExistingEvents.orElse(null) as Boolean?) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt index c626af48..ddc3fdd2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt @@ -28,30 +28,30 @@ class EventBackfillCreateResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("status") + @JsonProperty("close_time") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), + private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_start") - @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") + @JsonProperty("customer_id") @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), + private val customerId: JsonField = JsonMissing.of(), @JsonProperty("events_ingested") @ExcludeMissing private val eventsIngested: JsonField = JsonMissing.of(), - @JsonProperty("close_time") - @ExcludeMissing - private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("reverted_at") @ExcludeMissing private val revertedAt: JsonField = JsonMissing.of(), - @JsonProperty("customer_id") + @JsonProperty("status") @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), + private val status: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_end") + @ExcludeMissing + private val timeframeEnd: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_start") + @ExcludeMissing + private val timeframeStart: JsonField = JsonMissing.of(), @JsonProperty("deprecation_filter") @ExcludeMissing private val deprecationFilter: JsonField = JsonMissing.of(), @@ -60,18 +60,6 @@ private constructor( fun id(): String = id.getRequired("id") - /** The status of the backfill. */ - fun status(): Status = status.getRequired("status") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") - - /** The number of events ingested in this backfill. */ - fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. @@ -79,9 +67,7 @@ private constructor( fun closeTime(): Optional = Optional.ofNullable(closeTime.getNullable("close_time")) - /** The time at which this backfill was reverted. */ - fun revertedAt(): Optional = - Optional.ofNullable(revertedAt.getNullable("reverted_at")) + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -89,6 +75,20 @@ private constructor( */ fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + /** The number of events ingested in this backfill. */ + fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") + + /** The time at which this backfill was reverted. */ + fun revertedAt(): Optional = + Optional.ofNullable(revertedAt.getNullable("reverted_at")) + + /** The status of the backfill. */ + fun status(): Status = status.getRequired("status") + + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -98,26 +98,13 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The status of the backfill. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - /** The number of events ingested in this backfill. */ - @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. */ @JsonProperty("close_time") @ExcludeMissing fun _closeTime() = closeTime - /** The time at which this backfill was reverted. */ - @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -125,6 +112,19 @@ private constructor( */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + /** The number of events ingested in this backfill. */ + @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested + + /** The time at which this backfill was reverted. */ + @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + + /** The status of the backfill. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -140,14 +140,14 @@ private constructor( fun validate(): EventBackfillCreateResponse = apply { if (!validated) { id() - status() + closeTime() createdAt() - timeframeStart() - timeframeEnd() + customerId() eventsIngested() - closeTime() revertedAt() - customerId() + status() + timeframeEnd() + timeframeStart() deprecationFilter() validated = true } @@ -163,28 +163,28 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var closeTime: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() - private var timeframeEnd: JsonField = JsonMissing.of() + private var customerId: JsonField = JsonMissing.of() private var eventsIngested: JsonField = JsonMissing.of() - private var closeTime: JsonField = JsonMissing.of() private var revertedAt: JsonField = JsonMissing.of() - private var customerId: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var deprecationFilter: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillCreateResponse: EventBackfillCreateResponse) = apply { id = eventBackfillCreateResponse.id - status = eventBackfillCreateResponse.status + closeTime = eventBackfillCreateResponse.closeTime createdAt = eventBackfillCreateResponse.createdAt - timeframeStart = eventBackfillCreateResponse.timeframeStart - timeframeEnd = eventBackfillCreateResponse.timeframeEnd + customerId = eventBackfillCreateResponse.customerId eventsIngested = eventBackfillCreateResponse.eventsIngested - closeTime = eventBackfillCreateResponse.closeTime revertedAt = eventBackfillCreateResponse.revertedAt - customerId = eventBackfillCreateResponse.customerId + status = eventBackfillCreateResponse.status + timeframeEnd = eventBackfillCreateResponse.timeframeEnd + timeframeStart = eventBackfillCreateResponse.timeframeStart deprecationFilter = eventBackfillCreateResponse.deprecationFilter additionalProperties = eventBackfillCreateResponse.additionalProperties.toMutableMap() } @@ -193,37 +193,6 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** The status of the backfill. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** The status of the backfill. */ - fun status(status: JsonField) = apply { this.status = status } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) - - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } - - fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: JsonField) = apply { - this.eventsIngested = eventsIngested - } - /** * If in the future, the time at which the backfill will automatically close. If in the * past, the time at which the backfill was closed. @@ -236,13 +205,9 @@ private constructor( */ fun closeTime(closeTime: JsonField) = apply { this.closeTime = closeTime } - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: JsonField) = apply { - this.revertedAt = revertedAt - } + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -256,6 +221,41 @@ private constructor( */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) + + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: JsonField) = apply { + this.eventsIngested = eventsIngested + } + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: JsonField) = apply { + this.revertedAt = revertedAt + } + + /** The status of the backfill. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of the backfill. */ + fun status(status: JsonField) = apply { this.status = status } + + fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) + + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } + + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) + + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } + /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to @@ -295,14 +295,14 @@ private constructor( fun build(): EventBackfillCreateResponse = EventBackfillCreateResponse( id, - status, + closeTime, createdAt, - timeframeStart, - timeframeEnd, + customerId, eventsIngested, - closeTime, revertedAt, - customerId, + status, + timeframeEnd, + timeframeStart, deprecationFilter, additionalProperties.toImmutable(), ) @@ -382,15 +382,15 @@ private constructor( return true } - return /* spotless:off */ other is EventBackfillCreateResponse && id == other.id && status == other.status && createdAt == other.createdAt && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && eventsIngested == other.eventsIngested && closeTime == other.closeTime && revertedAt == other.revertedAt && customerId == other.customerId && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillCreateResponse && id == other.id && closeTime == other.closeTime && createdAt == other.createdAt && customerId == other.customerId && eventsIngested == other.eventsIngested && revertedAt == other.revertedAt && status == other.status && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, status, createdAt, timeframeStart, timeframeEnd, eventsIngested, closeTime, revertedAt, customerId, deprecationFilter, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, closeTime, createdAt, customerId, eventsIngested, revertedAt, status, timeframeEnd, timeframeStart, deprecationFilter, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EventBackfillCreateResponse{id=$id, status=$status, createdAt=$createdAt, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, eventsIngested=$eventsIngested, closeTime=$closeTime, revertedAt=$revertedAt, customerId=$customerId, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" + "EventBackfillCreateResponse{id=$id, closeTime=$closeTime, createdAt=$createdAt, customerId=$customerId, eventsIngested=$eventsIngested, revertedAt=$revertedAt, status=$status, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt index 806c9af5..5cb414a5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt @@ -28,30 +28,30 @@ class EventBackfillFetchResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("status") + @JsonProperty("close_time") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), + private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_start") - @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") + @JsonProperty("customer_id") @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), + private val customerId: JsonField = JsonMissing.of(), @JsonProperty("events_ingested") @ExcludeMissing private val eventsIngested: JsonField = JsonMissing.of(), - @JsonProperty("close_time") - @ExcludeMissing - private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("reverted_at") @ExcludeMissing private val revertedAt: JsonField = JsonMissing.of(), - @JsonProperty("customer_id") + @JsonProperty("status") @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), + private val status: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_end") + @ExcludeMissing + private val timeframeEnd: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_start") + @ExcludeMissing + private val timeframeStart: JsonField = JsonMissing.of(), @JsonProperty("deprecation_filter") @ExcludeMissing private val deprecationFilter: JsonField = JsonMissing.of(), @@ -60,18 +60,6 @@ private constructor( fun id(): String = id.getRequired("id") - /** The status of the backfill. */ - fun status(): Status = status.getRequired("status") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") - - /** The number of events ingested in this backfill. */ - fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. @@ -79,9 +67,7 @@ private constructor( fun closeTime(): Optional = Optional.ofNullable(closeTime.getNullable("close_time")) - /** The time at which this backfill was reverted. */ - fun revertedAt(): Optional = - Optional.ofNullable(revertedAt.getNullable("reverted_at")) + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -89,6 +75,20 @@ private constructor( */ fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + /** The number of events ingested in this backfill. */ + fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") + + /** The time at which this backfill was reverted. */ + fun revertedAt(): Optional = + Optional.ofNullable(revertedAt.getNullable("reverted_at")) + + /** The status of the backfill. */ + fun status(): Status = status.getRequired("status") + + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -98,26 +98,13 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The status of the backfill. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - /** The number of events ingested in this backfill. */ - @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. */ @JsonProperty("close_time") @ExcludeMissing fun _closeTime() = closeTime - /** The time at which this backfill was reverted. */ - @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -125,6 +112,19 @@ private constructor( */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + /** The number of events ingested in this backfill. */ + @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested + + /** The time at which this backfill was reverted. */ + @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + + /** The status of the backfill. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -140,14 +140,14 @@ private constructor( fun validate(): EventBackfillFetchResponse = apply { if (!validated) { id() - status() + closeTime() createdAt() - timeframeStart() - timeframeEnd() + customerId() eventsIngested() - closeTime() revertedAt() - customerId() + status() + timeframeEnd() + timeframeStart() deprecationFilter() validated = true } @@ -163,28 +163,28 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var closeTime: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() - private var timeframeEnd: JsonField = JsonMissing.of() + private var customerId: JsonField = JsonMissing.of() private var eventsIngested: JsonField = JsonMissing.of() - private var closeTime: JsonField = JsonMissing.of() private var revertedAt: JsonField = JsonMissing.of() - private var customerId: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var deprecationFilter: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillFetchResponse: EventBackfillFetchResponse) = apply { id = eventBackfillFetchResponse.id - status = eventBackfillFetchResponse.status + closeTime = eventBackfillFetchResponse.closeTime createdAt = eventBackfillFetchResponse.createdAt - timeframeStart = eventBackfillFetchResponse.timeframeStart - timeframeEnd = eventBackfillFetchResponse.timeframeEnd + customerId = eventBackfillFetchResponse.customerId eventsIngested = eventBackfillFetchResponse.eventsIngested - closeTime = eventBackfillFetchResponse.closeTime revertedAt = eventBackfillFetchResponse.revertedAt - customerId = eventBackfillFetchResponse.customerId + status = eventBackfillFetchResponse.status + timeframeEnd = eventBackfillFetchResponse.timeframeEnd + timeframeStart = eventBackfillFetchResponse.timeframeStart deprecationFilter = eventBackfillFetchResponse.deprecationFilter additionalProperties = eventBackfillFetchResponse.additionalProperties.toMutableMap() } @@ -193,37 +193,6 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** The status of the backfill. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** The status of the backfill. */ - fun status(status: JsonField) = apply { this.status = status } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) - - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } - - fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: JsonField) = apply { - this.eventsIngested = eventsIngested - } - /** * If in the future, the time at which the backfill will automatically close. If in the * past, the time at which the backfill was closed. @@ -236,13 +205,9 @@ private constructor( */ fun closeTime(closeTime: JsonField) = apply { this.closeTime = closeTime } - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: JsonField) = apply { - this.revertedAt = revertedAt - } + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -256,6 +221,41 @@ private constructor( */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) + + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: JsonField) = apply { + this.eventsIngested = eventsIngested + } + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: JsonField) = apply { + this.revertedAt = revertedAt + } + + /** The status of the backfill. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of the backfill. */ + fun status(status: JsonField) = apply { this.status = status } + + fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) + + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } + + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) + + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } + /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to @@ -295,14 +295,14 @@ private constructor( fun build(): EventBackfillFetchResponse = EventBackfillFetchResponse( id, - status, + closeTime, createdAt, - timeframeStart, - timeframeEnd, + customerId, eventsIngested, - closeTime, revertedAt, - customerId, + status, + timeframeEnd, + timeframeStart, deprecationFilter, additionalProperties.toImmutable(), ) @@ -382,15 +382,15 @@ private constructor( return true } - return /* spotless:off */ other is EventBackfillFetchResponse && id == other.id && status == other.status && createdAt == other.createdAt && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && eventsIngested == other.eventsIngested && closeTime == other.closeTime && revertedAt == other.revertedAt && customerId == other.customerId && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillFetchResponse && id == other.id && closeTime == other.closeTime && createdAt == other.createdAt && customerId == other.customerId && eventsIngested == other.eventsIngested && revertedAt == other.revertedAt && status == other.status && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, status, createdAt, timeframeStart, timeframeEnd, eventsIngested, closeTime, revertedAt, customerId, deprecationFilter, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, closeTime, createdAt, customerId, eventsIngested, revertedAt, status, timeframeEnd, timeframeStart, deprecationFilter, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EventBackfillFetchResponse{id=$id, status=$status, createdAt=$createdAt, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, eventsIngested=$eventsIngested, closeTime=$closeTime, revertedAt=$revertedAt, customerId=$customerId, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" + "EventBackfillFetchResponse{id=$id, closeTime=$closeTime, createdAt=$createdAt, customerId=$customerId, eventsIngested=$eventsIngested, revertedAt=$revertedAt, status=$status, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt index c619add7..40adf5c5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt @@ -67,10 +67,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/EventBackfillListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListResponse.kt index 5bbb12af..0ba3a719 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListResponse.kt @@ -28,30 +28,30 @@ class EventBackfillListResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("status") + @JsonProperty("close_time") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), + private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_start") - @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") + @JsonProperty("customer_id") @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), + private val customerId: JsonField = JsonMissing.of(), @JsonProperty("events_ingested") @ExcludeMissing private val eventsIngested: JsonField = JsonMissing.of(), - @JsonProperty("close_time") - @ExcludeMissing - private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("reverted_at") @ExcludeMissing private val revertedAt: JsonField = JsonMissing.of(), - @JsonProperty("customer_id") + @JsonProperty("status") @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), + private val status: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_end") + @ExcludeMissing + private val timeframeEnd: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_start") + @ExcludeMissing + private val timeframeStart: JsonField = JsonMissing.of(), @JsonProperty("deprecation_filter") @ExcludeMissing private val deprecationFilter: JsonField = JsonMissing.of(), @@ -60,18 +60,6 @@ private constructor( fun id(): String = id.getRequired("id") - /** The status of the backfill. */ - fun status(): Status = status.getRequired("status") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") - - /** The number of events ingested in this backfill. */ - fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. @@ -79,9 +67,7 @@ private constructor( fun closeTime(): Optional = Optional.ofNullable(closeTime.getNullable("close_time")) - /** The time at which this backfill was reverted. */ - fun revertedAt(): Optional = - Optional.ofNullable(revertedAt.getNullable("reverted_at")) + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -89,6 +75,20 @@ private constructor( */ fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + /** The number of events ingested in this backfill. */ + fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") + + /** The time at which this backfill was reverted. */ + fun revertedAt(): Optional = + Optional.ofNullable(revertedAt.getNullable("reverted_at")) + + /** The status of the backfill. */ + fun status(): Status = status.getRequired("status") + + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -98,26 +98,13 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The status of the backfill. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - /** The number of events ingested in this backfill. */ - @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. */ @JsonProperty("close_time") @ExcludeMissing fun _closeTime() = closeTime - /** The time at which this backfill was reverted. */ - @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -125,6 +112,19 @@ private constructor( */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + /** The number of events ingested in this backfill. */ + @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested + + /** The time at which this backfill was reverted. */ + @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + + /** The status of the backfill. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -140,14 +140,14 @@ private constructor( fun validate(): EventBackfillListResponse = apply { if (!validated) { id() - status() + closeTime() createdAt() - timeframeStart() - timeframeEnd() + customerId() eventsIngested() - closeTime() revertedAt() - customerId() + status() + timeframeEnd() + timeframeStart() deprecationFilter() validated = true } @@ -163,28 +163,28 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var closeTime: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() - private var timeframeEnd: JsonField = JsonMissing.of() + private var customerId: JsonField = JsonMissing.of() private var eventsIngested: JsonField = JsonMissing.of() - private var closeTime: JsonField = JsonMissing.of() private var revertedAt: JsonField = JsonMissing.of() - private var customerId: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var deprecationFilter: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillListResponse: EventBackfillListResponse) = apply { id = eventBackfillListResponse.id - status = eventBackfillListResponse.status + closeTime = eventBackfillListResponse.closeTime createdAt = eventBackfillListResponse.createdAt - timeframeStart = eventBackfillListResponse.timeframeStart - timeframeEnd = eventBackfillListResponse.timeframeEnd + customerId = eventBackfillListResponse.customerId eventsIngested = eventBackfillListResponse.eventsIngested - closeTime = eventBackfillListResponse.closeTime revertedAt = eventBackfillListResponse.revertedAt - customerId = eventBackfillListResponse.customerId + status = eventBackfillListResponse.status + timeframeEnd = eventBackfillListResponse.timeframeEnd + timeframeStart = eventBackfillListResponse.timeframeStart deprecationFilter = eventBackfillListResponse.deprecationFilter additionalProperties = eventBackfillListResponse.additionalProperties.toMutableMap() } @@ -193,37 +193,6 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** The status of the backfill. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** The status of the backfill. */ - fun status(status: JsonField) = apply { this.status = status } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) - - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } - - fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: JsonField) = apply { - this.eventsIngested = eventsIngested - } - /** * If in the future, the time at which the backfill will automatically close. If in the * past, the time at which the backfill was closed. @@ -236,13 +205,9 @@ private constructor( */ fun closeTime(closeTime: JsonField) = apply { this.closeTime = closeTime } - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: JsonField) = apply { - this.revertedAt = revertedAt - } + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -256,6 +221,41 @@ private constructor( */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) + + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: JsonField) = apply { + this.eventsIngested = eventsIngested + } + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: JsonField) = apply { + this.revertedAt = revertedAt + } + + /** The status of the backfill. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of the backfill. */ + fun status(status: JsonField) = apply { this.status = status } + + fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) + + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } + + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) + + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } + /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to @@ -295,14 +295,14 @@ private constructor( fun build(): EventBackfillListResponse = EventBackfillListResponse( id, - status, + closeTime, createdAt, - timeframeStart, - timeframeEnd, + customerId, eventsIngested, - closeTime, revertedAt, - customerId, + status, + timeframeEnd, + timeframeStart, deprecationFilter, additionalProperties.toImmutable(), ) @@ -382,15 +382,15 @@ private constructor( return true } - return /* spotless:off */ other is EventBackfillListResponse && id == other.id && status == other.status && createdAt == other.createdAt && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && eventsIngested == other.eventsIngested && closeTime == other.closeTime && revertedAt == other.revertedAt && customerId == other.customerId && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillListResponse && id == other.id && closeTime == other.closeTime && createdAt == other.createdAt && customerId == other.customerId && eventsIngested == other.eventsIngested && revertedAt == other.revertedAt && status == other.status && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, status, createdAt, timeframeStart, timeframeEnd, eventsIngested, closeTime, revertedAt, customerId, deprecationFilter, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, closeTime, createdAt, customerId, eventsIngested, revertedAt, status, timeframeEnd, timeframeStart, deprecationFilter, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EventBackfillListResponse{id=$id, status=$status, createdAt=$createdAt, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, eventsIngested=$eventsIngested, closeTime=$closeTime, revertedAt=$revertedAt, customerId=$customerId, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" + "EventBackfillListResponse{id=$id, closeTime=$closeTime, createdAt=$createdAt, customerId=$customerId, eventsIngested=$eventsIngested, revertedAt=$revertedAt, status=$status, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt index 79a8cc25..40e14a1c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt @@ -28,30 +28,30 @@ class EventBackfillRevertResponse @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("status") + @JsonProperty("close_time") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), + private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_start") - @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") + @JsonProperty("customer_id") @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), + private val customerId: JsonField = JsonMissing.of(), @JsonProperty("events_ingested") @ExcludeMissing private val eventsIngested: JsonField = JsonMissing.of(), - @JsonProperty("close_time") - @ExcludeMissing - private val closeTime: JsonField = JsonMissing.of(), @JsonProperty("reverted_at") @ExcludeMissing private val revertedAt: JsonField = JsonMissing.of(), - @JsonProperty("customer_id") + @JsonProperty("status") @ExcludeMissing - private val customerId: JsonField = JsonMissing.of(), + private val status: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_end") + @ExcludeMissing + private val timeframeEnd: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_start") + @ExcludeMissing + private val timeframeStart: JsonField = JsonMissing.of(), @JsonProperty("deprecation_filter") @ExcludeMissing private val deprecationFilter: JsonField = JsonMissing.of(), @@ -60,18 +60,6 @@ private constructor( fun id(): String = id.getRequired("id") - /** The status of the backfill. */ - fun status(): Status = status.getRequired("status") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") - - /** The number of events ingested in this backfill. */ - fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. @@ -79,9 +67,7 @@ private constructor( fun closeTime(): Optional = Optional.ofNullable(closeTime.getNullable("close_time")) - /** The time at which this backfill was reverted. */ - fun revertedAt(): Optional = - Optional.ofNullable(revertedAt.getNullable("reverted_at")) + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -89,6 +75,20 @@ private constructor( */ fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + /** The number of events ingested in this backfill. */ + fun eventsIngested(): Long = eventsIngested.getRequired("events_ingested") + + /** The time at which this backfill was reverted. */ + fun revertedAt(): Optional = + Optional.ofNullable(revertedAt.getNullable("reverted_at")) + + /** The status of the backfill. */ + fun status(): Status = status.getRequired("status") + + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -98,26 +98,13 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The status of the backfill. */ - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - /** The number of events ingested in this backfill. */ - @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested - /** * If in the future, the time at which the backfill will automatically close. If in the past, * the time at which the backfill was closed. */ @JsonProperty("close_time") @ExcludeMissing fun _closeTime() = closeTime - /** The time at which this backfill was reverted. */ - @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -125,6 +112,19 @@ private constructor( */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + /** The number of events ingested in this backfill. */ + @JsonProperty("events_ingested") @ExcludeMissing fun _eventsIngested() = eventsIngested + + /** The time at which this backfill was reverted. */ + @JsonProperty("reverted_at") @ExcludeMissing fun _revertedAt() = revertedAt + + /** The status of the backfill. */ + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart + /** * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the set of events to deprecate @@ -140,14 +140,14 @@ private constructor( fun validate(): EventBackfillRevertResponse = apply { if (!validated) { id() - status() + closeTime() createdAt() - timeframeStart() - timeframeEnd() + customerId() eventsIngested() - closeTime() revertedAt() - customerId() + status() + timeframeEnd() + timeframeStart() deprecationFilter() validated = true } @@ -163,28 +163,28 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() + private var closeTime: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() - private var timeframeEnd: JsonField = JsonMissing.of() + private var customerId: JsonField = JsonMissing.of() private var eventsIngested: JsonField = JsonMissing.of() - private var closeTime: JsonField = JsonMissing.of() private var revertedAt: JsonField = JsonMissing.of() - private var customerId: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var deprecationFilter: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillRevertResponse: EventBackfillRevertResponse) = apply { id = eventBackfillRevertResponse.id - status = eventBackfillRevertResponse.status + closeTime = eventBackfillRevertResponse.closeTime createdAt = eventBackfillRevertResponse.createdAt - timeframeStart = eventBackfillRevertResponse.timeframeStart - timeframeEnd = eventBackfillRevertResponse.timeframeEnd + customerId = eventBackfillRevertResponse.customerId eventsIngested = eventBackfillRevertResponse.eventsIngested - closeTime = eventBackfillRevertResponse.closeTime revertedAt = eventBackfillRevertResponse.revertedAt - customerId = eventBackfillRevertResponse.customerId + status = eventBackfillRevertResponse.status + timeframeEnd = eventBackfillRevertResponse.timeframeEnd + timeframeStart = eventBackfillRevertResponse.timeframeStart deprecationFilter = eventBackfillRevertResponse.deprecationFilter additionalProperties = eventBackfillRevertResponse.additionalProperties.toMutableMap() } @@ -193,37 +193,6 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** The status of the backfill. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** The status of the backfill. */ - fun status(status: JsonField) = apply { this.status = status } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) - - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } - - fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) - - /** The number of events ingested in this backfill. */ - fun eventsIngested(eventsIngested: JsonField) = apply { - this.eventsIngested = eventsIngested - } - /** * If in the future, the time at which the backfill will automatically close. If in the * past, the time at which the backfill was closed. @@ -236,13 +205,9 @@ private constructor( */ fun closeTime(closeTime: JsonField) = apply { this.closeTime = closeTime } - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - /** The time at which this backfill was reverted. */ - fun revertedAt(revertedAt: JsonField) = apply { - this.revertedAt = revertedAt - } + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } /** * The Orb-generated ID of the customer to which this backfill is scoped. If `null`, this @@ -256,6 +221,41 @@ private constructor( */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: Long) = eventsIngested(JsonField.of(eventsIngested)) + + /** The number of events ingested in this backfill. */ + fun eventsIngested(eventsIngested: JsonField) = apply { + this.eventsIngested = eventsIngested + } + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: OffsetDateTime) = revertedAt(JsonField.of(revertedAt)) + + /** The time at which this backfill was reverted. */ + fun revertedAt(revertedAt: JsonField) = apply { + this.revertedAt = revertedAt + } + + /** The status of the backfill. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** The status of the backfill. */ + fun status(status: JsonField) = apply { this.status = status } + + fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) + + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } + + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) + + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } + /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to @@ -295,14 +295,14 @@ private constructor( fun build(): EventBackfillRevertResponse = EventBackfillRevertResponse( id, - status, + closeTime, createdAt, - timeframeStart, - timeframeEnd, + customerId, eventsIngested, - closeTime, revertedAt, - customerId, + status, + timeframeEnd, + timeframeStart, deprecationFilter, additionalProperties.toImmutable(), ) @@ -382,15 +382,15 @@ private constructor( return true } - return /* spotless:off */ other is EventBackfillRevertResponse && id == other.id && status == other.status && createdAt == other.createdAt && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && eventsIngested == other.eventsIngested && closeTime == other.closeTime && revertedAt == other.revertedAt && customerId == other.customerId && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillRevertResponse && id == other.id && closeTime == other.closeTime && createdAt == other.createdAt && customerId == other.customerId && eventsIngested == other.eventsIngested && revertedAt == other.revertedAt && status == other.status && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && deprecationFilter == other.deprecationFilter && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, status, createdAt, timeframeStart, timeframeEnd, eventsIngested, closeTime, revertedAt, customerId, deprecationFilter, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, closeTime, createdAt, customerId, eventsIngested, revertedAt, status, timeframeEnd, timeframeStart, deprecationFilter, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EventBackfillRevertResponse{id=$id, status=$status, createdAt=$createdAt, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, eventsIngested=$eventsIngested, closeTime=$closeTime, revertedAt=$revertedAt, customerId=$customerId, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" + "EventBackfillRevertResponse{id=$id, closeTime=$closeTime, createdAt=$createdAt, customerId=$customerId, eventsIngested=$eventsIngested, revertedAt=$revertedAt, status=$status, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, deprecationFilter=$deprecationFilter, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt index 91053f8d..833c590a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt @@ -168,10 +168,23 @@ constructor( * If this ingestion request is part of a backfill, this parameter ties the ingested events * to the backfill */ - fun backfillId(backfillId: String) = apply { this.backfillId = backfillId } + fun backfillId(backfillId: String?) = apply { this.backfillId = backfillId } + + /** + * If this ingestion request is part of a backfill, this parameter ties the ingested events + * to the backfill + */ + fun backfillId(backfillId: Optional) = backfillId(backfillId.orElse(null)) + + /** Flag to enable additional debug information in the endpoint response */ + fun debug(debug: Boolean?) = apply { this.debug = debug } /** Flag to enable additional debug information in the endpoint response */ - fun debug(debug: Boolean) = apply { this.debug = debug } + fun debug(debug: Boolean) = debug(debug as Boolean?) + + /** Flag to enable additional debug information in the endpoint response */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun debug(debug: Optional) = debug(debug.orElse(null) as Boolean?) fun events(events: List) = apply { body.events(events) } @@ -308,33 +321,25 @@ constructor( class Event @JsonCreator private constructor( - @JsonProperty("customer_id") private val customerId: String?, - @JsonProperty("external_customer_id") private val externalCustomerId: String?, @JsonProperty("event_name") private val eventName: String, - @JsonProperty("timestamp") private val timestamp: OffsetDateTime, - @JsonProperty("properties") private val properties: JsonValue, @JsonProperty("idempotency_key") private val idempotencyKey: String, + @JsonProperty("properties") private val properties: JsonValue, + @JsonProperty("timestamp") private val timestamp: OffsetDateTime, + @JsonProperty("customer_id") private val customerId: String?, + @JsonProperty("external_customer_id") private val externalCustomerId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The Orb Customer identifier */ - @JsonProperty("customer_id") - fun customerId(): Optional = Optional.ofNullable(customerId) - - /** An alias for the Orb customer, whose mapping is specified when creating the customer */ - @JsonProperty("external_customer_id") - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) - /** A name to meaningfully identify the action or event type. */ @JsonProperty("event_name") fun eventName(): String = eventName /** - * An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the - * time that usage was recorded, and is particularly important to attribute usage to a given - * billing period. + * A unique value, generated by the client, that is used to de-duplicate events. Exactly one + * event with a given idempotency key will be ingested, which allows for safe request + * retries. */ - @JsonProperty("timestamp") fun timestamp(): OffsetDateTime = timestamp + @JsonProperty("idempotency_key") fun idempotencyKey(): String = idempotencyKey /** * A dictionary of custom properties. Values in this dictionary must be numeric, boolean, or @@ -343,11 +348,19 @@ constructor( @JsonProperty("properties") fun properties(): JsonValue = properties /** - * A unique value, generated by the client, that is used to de-duplicate events. Exactly one - * event with a given idempotency key will be ingested, which allows for safe request - * retries. + * An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the + * time that usage was recorded, and is particularly important to attribute usage to a given + * billing period. */ - @JsonProperty("idempotency_key") fun idempotencyKey(): String = idempotencyKey + @JsonProperty("timestamp") fun timestamp(): OffsetDateTime = timestamp + + /** The Orb Customer identifier */ + @JsonProperty("customer_id") + fun customerId(): Optional = Optional.ofNullable(customerId) + + /** An alias for the Orb customer, whose mapping is specified when creating the customer */ + @JsonProperty("external_customer_id") + fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) @JsonAnyGetter @ExcludeMissing @@ -362,37 +375,42 @@ constructor( class Builder { - private var customerId: String? = null - private var externalCustomerId: String? = null private var eventName: String? = null - private var timestamp: OffsetDateTime? = null - private var properties: JsonValue? = null private var idempotencyKey: String? = null + private var properties: JsonValue? = null + private var timestamp: OffsetDateTime? = null + private var customerId: String? = null + private var externalCustomerId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(event: Event) = apply { - customerId = event.customerId - externalCustomerId = event.externalCustomerId eventName = event.eventName - timestamp = event.timestamp - properties = event.properties idempotencyKey = event.idempotencyKey + properties = event.properties + timestamp = event.timestamp + customerId = event.customerId + externalCustomerId = event.externalCustomerId additionalProperties = event.additionalProperties.toMutableMap() } - /** The Orb Customer identifier */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + /** A name to meaningfully identify the action or event type. */ + fun eventName(eventName: String) = apply { this.eventName = eventName } /** - * An alias for the Orb customer, whose mapping is specified when creating the customer + * A unique value, generated by the client, that is used to de-duplicate events. Exactly + * one event with a given idempotency key will be ingested, which allows for safe + * request retries. */ - fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + fun idempotencyKey(idempotencyKey: String) = apply { + this.idempotencyKey = idempotencyKey } - /** A name to meaningfully identify the action or event type. */ - fun eventName(eventName: String) = apply { this.eventName = eventName } + /** + * A dictionary of custom properties. Values in this dictionary must be numeric, + * boolean, or strings. Nested dictionaries are disallowed. + */ + fun properties(properties: JsonValue) = apply { this.properties = properties } /** * An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the @@ -401,20 +419,24 @@ constructor( */ fun timestamp(timestamp: OffsetDateTime) = apply { this.timestamp = timestamp } + /** The Orb Customer identifier */ + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** The Orb Customer identifier */ + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) + /** - * A dictionary of custom properties. Values in this dictionary must be numeric, - * boolean, or strings. Nested dictionaries are disallowed. + * An alias for the Orb customer, whose mapping is specified when creating the customer */ - fun properties(properties: JsonValue) = apply { this.properties = properties } + fun externalCustomerId(externalCustomerId: String?) = apply { + this.externalCustomerId = externalCustomerId + } /** - * A unique value, generated by the client, that is used to de-duplicate events. Exactly - * one event with a given idempotency key will be ingested, which allows for safe - * request retries. + * An alias for the Orb customer, whose mapping is specified when creating the customer */ - fun idempotencyKey(idempotencyKey: String) = apply { - this.idempotencyKey = idempotencyKey - } + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -437,12 +459,12 @@ constructor( fun build(): Event = Event( - customerId, - externalCustomerId, checkNotNull(eventName) { "`eventName` is required but was not set" }, - checkNotNull(timestamp) { "`timestamp` is required but was not set" }, - checkNotNull(properties) { "`properties` is required but was not set" }, checkNotNull(idempotencyKey) { "`idempotencyKey` is required but was not set" }, + checkNotNull(properties) { "`properties` is required but was not set" }, + checkNotNull(timestamp) { "`timestamp` is required but was not set" }, + customerId, + externalCustomerId, additionalProperties.toImmutable(), ) } @@ -452,17 +474,17 @@ constructor( return true } - return /* spotless:off */ other is Event && customerId == other.customerId && externalCustomerId == other.externalCustomerId && eventName == other.eventName && timestamp == other.timestamp && properties == other.properties && idempotencyKey == other.idempotencyKey && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Event && eventName == other.eventName && idempotencyKey == other.idempotencyKey && properties == other.properties && timestamp == other.timestamp && customerId == other.customerId && externalCustomerId == other.externalCustomerId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(customerId, externalCustomerId, eventName, timestamp, properties, idempotencyKey, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(eventName, idempotencyKey, properties, timestamp, customerId, externalCustomerId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Event{customerId=$customerId, externalCustomerId=$externalCustomerId, eventName=$eventName, timestamp=$timestamp, properties=$properties, idempotencyKey=$idempotencyKey, additionalProperties=$additionalProperties}" + "Event{eventName=$eventName, idempotencyKey=$idempotencyKey, properties=$properties, timestamp=$timestamp, customerId=$customerId, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestResponse.kt index dd16b94a..bcf9737a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestResponse.kt @@ -20,19 +20,13 @@ import java.util.Optional class EventIngestResponse @JsonCreator private constructor( - @JsonProperty("debug") @ExcludeMissing private val debug: JsonField = JsonMissing.of(), @JsonProperty("validation_failed") @ExcludeMissing private val validationFailed: JsonField> = JsonMissing.of(), + @JsonProperty("debug") @ExcludeMissing private val debug: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * Optional debug information (only present when debug=true is passed to the endpoint). Contains - * ingested and duplicate event idempotency keys. - */ - fun debug(): Optional = Optional.ofNullable(debug.getNullable("debug")) - /** * Contains all failing validation events. In the case of a 200, this array will always be * empty. This field will always be present. @@ -44,7 +38,7 @@ private constructor( * Optional debug information (only present when debug=true is passed to the endpoint). Contains * ingested and duplicate event idempotency keys. */ - @JsonProperty("debug") @ExcludeMissing fun _debug() = debug + fun debug(): Optional = Optional.ofNullable(debug.getNullable("debug")) /** * Contains all failing validation events. In the case of a 200, this array will always be @@ -52,6 +46,12 @@ private constructor( */ @JsonProperty("validation_failed") @ExcludeMissing fun _validationFailed() = validationFailed + /** + * Optional debug information (only present when debug=true is passed to the endpoint). Contains + * ingested and duplicate event idempotency keys. + */ + @JsonProperty("debug") @ExcludeMissing fun _debug() = debug + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -60,8 +60,8 @@ private constructor( fun validate(): EventIngestResponse = apply { if (!validated) { - debug().map { it.validate() } validationFailed().forEach { it.validate() } + debug().map { it.validate() } validated = true } } @@ -75,29 +75,17 @@ private constructor( class Builder { - private var debug: JsonField = JsonMissing.of() private var validationFailed: JsonField> = JsonMissing.of() + private var debug: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventIngestResponse: EventIngestResponse) = apply { - debug = eventIngestResponse.debug validationFailed = eventIngestResponse.validationFailed + debug = eventIngestResponse.debug additionalProperties = eventIngestResponse.additionalProperties.toMutableMap() } - /** - * Optional debug information (only present when debug=true is passed to the endpoint). - * Contains ingested and duplicate event idempotency keys. - */ - fun debug(debug: Debug) = debug(JsonField.of(debug)) - - /** - * Optional debug information (only present when debug=true is passed to the endpoint). - * Contains ingested and duplicate event idempotency keys. - */ - fun debug(debug: JsonField) = apply { this.debug = debug } - /** * Contains all failing validation events. In the case of a 200, this array will always be * empty. This field will always be present. @@ -113,6 +101,18 @@ private constructor( this.validationFailed = validationFailed } + /** + * Optional debug information (only present when debug=true is passed to the endpoint). + * Contains ingested and duplicate event idempotency keys. + */ + fun debug(debug: Debug) = debug(JsonField.of(debug)) + + /** + * Optional debug information (only present when debug=true is passed to the endpoint). + * Contains ingested and duplicate event idempotency keys. + */ + fun debug(debug: JsonField) = apply { this.debug = debug } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -134,8 +134,8 @@ private constructor( fun build(): EventIngestResponse = EventIngestResponse( - debug, validationFailed.map { it.toImmutable() }, + debug, additionalProperties.toImmutable(), ) } @@ -387,15 +387,15 @@ private constructor( return true } - return /* spotless:off */ other is EventIngestResponse && debug == other.debug && validationFailed == other.validationFailed && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EventIngestResponse && validationFailed == other.validationFailed && debug == other.debug && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(debug, validationFailed, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(validationFailed, debug, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EventIngestResponse{debug=$debug, validationFailed=$validationFailed, additionalProperties=$additionalProperties}" + "EventIngestResponse{validationFailed=$validationFailed, debug=$debug, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt index 850c4e7a..f2bce686 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt @@ -135,18 +135,32 @@ constructor( * The end of the timeframe, exclusive, in which to search events. If not specified, the * current time is used. */ - fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { + fun timeframeEnd(timeframeEnd: OffsetDateTime?) = apply { this.timeframeEnd = timeframeEnd } + /** + * The end of the timeframe, exclusive, in which to search events. If not specified, the + * current time is used. + */ + fun timeframeEnd(timeframeEnd: Optional) = + timeframeEnd(timeframeEnd.orElse(null)) + /** * The start of the timeframe, inclusive, in which to search events. If not specified, * the one week ago is used. */ - fun timeframeStart(timeframeStart: OffsetDateTime) = apply { + fun timeframeStart(timeframeStart: OffsetDateTime?) = apply { this.timeframeStart = timeframeStart } + /** + * The start of the timeframe, inclusive, in which to search events. If not specified, + * the one week ago is used. + */ + fun timeframeStart(timeframeStart: Optional) = + timeframeStart(timeframeStart.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -233,16 +247,30 @@ constructor( * The end of the timeframe, exclusive, in which to search events. If not specified, the * current time is used. */ - fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { body.timeframeEnd(timeframeEnd) } + fun timeframeEnd(timeframeEnd: OffsetDateTime?) = apply { body.timeframeEnd(timeframeEnd) } + + /** + * The end of the timeframe, exclusive, in which to search events. If not specified, the + * current time is used. + */ + fun timeframeEnd(timeframeEnd: Optional) = + timeframeEnd(timeframeEnd.orElse(null)) /** * The start of the timeframe, inclusive, in which to search events. If not specified, the * one week ago is used. */ - fun timeframeStart(timeframeStart: OffsetDateTime) = apply { + fun timeframeStart(timeframeStart: OffsetDateTime?) = apply { body.timeframeStart(timeframeStart) } + /** + * The start of the timeframe, inclusive, in which to search events. If not specified, the + * one week ago is used. + */ + fun timeframeStart(timeframeStart: Optional) = + timeframeStart(timeframeStart.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt index a1abec9b..113b29b2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt @@ -102,21 +102,21 @@ private constructor( @JsonProperty("customer_id") @ExcludeMissing private val customerId: JsonField = JsonMissing.of(), - @JsonProperty("external_customer_id") + @JsonProperty("deprecated") @ExcludeMissing - private val externalCustomerId: JsonField = JsonMissing.of(), + private val deprecated: JsonField = JsonMissing.of(), @JsonProperty("event_name") @ExcludeMissing private val eventName: JsonField = JsonMissing.of(), + @JsonProperty("external_customer_id") + @ExcludeMissing + private val externalCustomerId: JsonField = JsonMissing.of(), @JsonProperty("properties") @ExcludeMissing private val properties: JsonValue = JsonMissing.of(), @JsonProperty("timestamp") @ExcludeMissing private val timestamp: JsonField = JsonMissing.of(), - @JsonProperty("deprecated") - @ExcludeMissing - private val deprecated: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -132,13 +132,16 @@ private constructor( fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) - /** An alias for the Orb customer, whose mapping is specified when creating the customer */ - fun externalCustomerId(): Optional = - Optional.ofNullable(externalCustomerId.getNullable("external_customer_id")) + /** A boolean indicating whether the event is currently deprecated. */ + fun deprecated(): Boolean = deprecated.getRequired("deprecated") /** A name to meaningfully identify the action or event type. */ fun eventName(): String = eventName.getRequired("event_name") + /** An alias for the Orb customer, whose mapping is specified when creating the customer */ + fun externalCustomerId(): Optional = + Optional.ofNullable(externalCustomerId.getNullable("external_customer_id")) + /** * An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the * time that usage was recorded, and is particularly important to attribute usage to a given @@ -146,9 +149,6 @@ private constructor( */ fun timestamp(): OffsetDateTime = timestamp.getRequired("timestamp") - /** A boolean indicating whether the event is currently deprecated. */ - fun deprecated(): Boolean = deprecated.getRequired("deprecated") - /** * A unique value, generated by the client, that is used to de-duplicate events. Exactly one * event with a given idempotency key will be ingested, which allows for safe request @@ -159,14 +159,17 @@ private constructor( /** The Orb Customer identifier */ @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + /** A boolean indicating whether the event is currently deprecated. */ + @JsonProperty("deprecated") @ExcludeMissing fun _deprecated() = deprecated + + /** A name to meaningfully identify the action or event type. */ + @JsonProperty("event_name") @ExcludeMissing fun _eventName() = eventName + /** An alias for the Orb customer, whose mapping is specified when creating the customer */ @JsonProperty("external_customer_id") @ExcludeMissing fun _externalCustomerId() = externalCustomerId - /** A name to meaningfully identify the action or event type. */ - @JsonProperty("event_name") @ExcludeMissing fun _eventName() = eventName - /** * A dictionary of custom properties. Values in this dictionary must be numeric, boolean, or * strings. Nested dictionaries are disallowed. @@ -180,9 +183,6 @@ private constructor( */ @JsonProperty("timestamp") @ExcludeMissing fun _timestamp() = timestamp - /** A boolean indicating whether the event is currently deprecated. */ - @JsonProperty("deprecated") @ExcludeMissing fun _deprecated() = deprecated - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -193,10 +193,10 @@ private constructor( if (!validated) { id() customerId() - externalCustomerId() + deprecated() eventName() + externalCustomerId() timestamp() - deprecated() validated = true } } @@ -212,22 +212,22 @@ private constructor( private var id: JsonField = JsonMissing.of() private var customerId: JsonField = JsonMissing.of() - private var externalCustomerId: JsonField = JsonMissing.of() + private var deprecated: JsonField = JsonMissing.of() private var eventName: JsonField = JsonMissing.of() + private var externalCustomerId: JsonField = JsonMissing.of() private var properties: JsonValue = JsonMissing.of() private var timestamp: JsonField = JsonMissing.of() - private var deprecated: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { id = data.id customerId = data.customerId - externalCustomerId = data.externalCustomerId + deprecated = data.deprecated eventName = data.eventName + externalCustomerId = data.externalCustomerId properties = data.properties timestamp = data.timestamp - deprecated = data.deprecated additionalProperties = data.additionalProperties.toMutableMap() } @@ -251,6 +251,18 @@ private constructor( /** The Orb Customer identifier */ fun customerId(customerId: JsonField) = apply { this.customerId = customerId } + /** A boolean indicating whether the event is currently deprecated. */ + fun deprecated(deprecated: Boolean) = deprecated(JsonField.of(deprecated)) + + /** A boolean indicating whether the event is currently deprecated. */ + fun deprecated(deprecated: JsonField) = apply { this.deprecated = deprecated } + + /** A name to meaningfully identify the action or event type. */ + fun eventName(eventName: String) = eventName(JsonField.of(eventName)) + + /** A name to meaningfully identify the action or event type. */ + fun eventName(eventName: JsonField) = apply { this.eventName = eventName } + /** * An alias for the Orb customer, whose mapping is specified when creating the customer */ @@ -264,12 +276,6 @@ private constructor( this.externalCustomerId = externalCustomerId } - /** A name to meaningfully identify the action or event type. */ - fun eventName(eventName: String) = eventName(JsonField.of(eventName)) - - /** A name to meaningfully identify the action or event type. */ - fun eventName(eventName: JsonField) = apply { this.eventName = eventName } - /** * A dictionary of custom properties. Values in this dictionary must be numeric, * boolean, or strings. Nested dictionaries are disallowed. @@ -292,12 +298,6 @@ private constructor( this.timestamp = timestamp } - /** A boolean indicating whether the event is currently deprecated. */ - fun deprecated(deprecated: Boolean) = deprecated(JsonField.of(deprecated)) - - /** A boolean indicating whether the event is currently deprecated. */ - fun deprecated(deprecated: JsonField) = apply { this.deprecated = deprecated } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -321,11 +321,11 @@ private constructor( Data( id, customerId, - externalCustomerId, + deprecated, eventName, + externalCustomerId, properties, timestamp, - deprecated, additionalProperties.toImmutable(), ) } @@ -335,17 +335,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && id == other.id && customerId == other.customerId && externalCustomerId == other.externalCustomerId && eventName == other.eventName && properties == other.properties && timestamp == other.timestamp && deprecated == other.deprecated && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && id == other.id && customerId == other.customerId && deprecated == other.deprecated && eventName == other.eventName && externalCustomerId == other.externalCustomerId && properties == other.properties && timestamp == other.timestamp && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, customerId, externalCustomerId, eventName, properties, timestamp, deprecated, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, customerId, deprecated, eventName, externalCustomerId, properties, timestamp, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{id=$id, customerId=$customerId, externalCustomerId=$externalCustomerId, eventName=$eventName, properties=$properties, timestamp=$timestamp, deprecated=$deprecated, additionalProperties=$additionalProperties}" + "Data{id=$id, customerId=$customerId, deprecated=$deprecated, eventName=$eventName, externalCustomerId=$externalCustomerId, properties=$properties, timestamp=$timestamp, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt index 43e96ee6..7d877ef2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt @@ -152,15 +152,24 @@ constructor( fun timestamp(timestamp: OffsetDateTime) = apply { this.timestamp = timestamp } /** The Orb Customer identifier */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** The Orb Customer identifier */ + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** * An alias for the Orb customer, whose mapping is specified when creating the customer */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * An alias for the Orb customer, whose mapping is specified when creating the customer + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -251,13 +260,20 @@ constructor( fun timestamp(timestamp: OffsetDateTime) = apply { body.timestamp(timestamp) } /** The Orb Customer identifier */ - fun customerId(customerId: String) = apply { body.customerId(customerId) } + fun customerId(customerId: String?) = apply { body.customerId(customerId) } + + /** The Orb Customer identifier */ + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** An alias for the Orb customer, whose mapping is specified when creating the customer */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } + /** An alias for the Orb customer, whose mapping is specified when creating the customer */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt index deca0143..69ad89ee 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt @@ -111,10 +111,31 @@ 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?) + + /** + * The end of the timeframe, exclusive, in which to return event volume. If not specified, + * the current time is used. All datetime values are converted to UTC time.If the specified + * time isn't hour-aligned, the response includes the event volumecount for the hour the + * time falls in. + */ + fun timeframeEnd(timeframeEnd: OffsetDateTime?) = apply { this.timeframeEnd = timeframeEnd } /** * The end of the timeframe, exclusive, in which to return event volume. If not specified, @@ -122,7 +143,8 @@ constructor( * time isn't hour-aligned, the response includes the event volumecount for the hour the * time falls in. */ - fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: Optional) = + timeframeEnd(timeframeEnd.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt index 5c26e4da..63840b32 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt @@ -96,33 +96,33 @@ private constructor( class Data @JsonCreator private constructor( - @JsonProperty("timeframe_start") + @JsonProperty("count") @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), + private val count: JsonField = JsonMissing.of(), @JsonProperty("timeframe_end") @ExcludeMissing private val timeframeEnd: JsonField = JsonMissing.of(), - @JsonProperty("count") + @JsonProperty("timeframe_start") @ExcludeMissing - private val count: JsonField = JsonMissing.of(), + private val timeframeStart: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") - /** The number of events ingested with a timestamp between the timeframe */ fun count(): Long = count.getRequired("count") - @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") /** The number of events ingested with a timestamp between the timeframe */ @JsonProperty("count") @ExcludeMissing fun _count() = count + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -131,9 +131,9 @@ private constructor( fun validate(): Data = apply { if (!validated) { - timeframeStart() - timeframeEnd() count() + timeframeEnd() + timeframeStart() validated = true } } @@ -147,25 +147,24 @@ private constructor( class Builder { - private var timeframeStart: JsonField = JsonMissing.of() - private var timeframeEnd: JsonField = JsonMissing.of() private var count: JsonField = JsonMissing.of() + private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { - timeframeStart = data.timeframeStart - timeframeEnd = data.timeframeEnd count = data.count + timeframeEnd = data.timeframeEnd + timeframeStart = data.timeframeStart additionalProperties = data.additionalProperties.toMutableMap() } - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) + /** The number of events ingested with a timestamp between the timeframe */ + fun count(count: Long) = count(JsonField.of(count)) - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } + /** The number of events ingested with a timestamp between the timeframe */ + fun count(count: JsonField) = apply { this.count = count } fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) @@ -174,11 +173,12 @@ private constructor( this.timeframeEnd = timeframeEnd } - /** The number of events ingested with a timestamp between the timeframe */ - fun count(count: Long) = count(JsonField.of(count)) + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) - /** The number of events ingested with a timestamp between the timeframe */ - fun count(count: JsonField) = apply { this.count = count } + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -201,9 +201,9 @@ private constructor( fun build(): Data = Data( - timeframeStart, - timeframeEnd, count, + timeframeEnd, + timeframeStart, additionalProperties.toImmutable(), ) } @@ -213,17 +213,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && count == other.count && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && count == other.count && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(timeframeStart, timeframeEnd, count, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(count, timeframeEnd, timeframeStart, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, count=$count, additionalProperties=$additionalProperties}" + "Data{count=$count, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt index d1470fa7..08fee8df 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt @@ -41,48 +41,35 @@ import kotlin.jvm.optionals.getOrNull class Invoice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonProperty("voided_at") - @ExcludeMissing - private val voidedAt: JsonField = JsonMissing.of(), - @JsonProperty("paid_at") - @ExcludeMissing - private val paidAt: JsonField = JsonMissing.of(), - @JsonProperty("issued_at") - @ExcludeMissing - private val issuedAt: JsonField = JsonMissing.of(), - @JsonProperty("scheduled_issue_at") + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount_due") @ExcludeMissing - private val scheduledIssueAt: JsonField = JsonMissing.of(), + private val amountDue: JsonField = JsonMissing.of(), @JsonProperty("auto_collection") @ExcludeMissing private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("issue_failed_at") - @ExcludeMissing - private val issueFailedAt: JsonField = JsonMissing.of(), - @JsonProperty("sync_failed_at") - @ExcludeMissing - private val syncFailedAt: JsonField = JsonMissing.of(), - @JsonProperty("payment_failed_at") - @ExcludeMissing - private val paymentFailedAt: JsonField = JsonMissing.of(), - @JsonProperty("payment_started_at") - @ExcludeMissing - private val paymentStartedAt: JsonField = JsonMissing.of(), - @JsonProperty("amount_due") + @JsonProperty("billing_address") @ExcludeMissing - private val amountDue: JsonField = JsonMissing.of(), + private val billingAddress: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_notes") + @ExcludeMissing + private val creditNotes: JsonField> = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @JsonProperty("customer") @ExcludeMissing private val customer: JsonField = JsonMissing.of(), + @JsonProperty("customer_balance_transactions") + @ExcludeMissing + private val customerBalanceTransactions: JsonField> = + JsonMissing.of(), + @JsonProperty("customer_tax_id") + @ExcludeMissing + private val customerTaxId: JsonField = JsonMissing.of(), @JsonProperty("discount") @ExcludeMissing private val discount: JsonValue = JsonMissing.of(), @JsonProperty("discounts") @ExcludeMissing @@ -90,136 +77,90 @@ private constructor( @JsonProperty("due_date") @ExcludeMissing private val dueDate: JsonField = JsonMissing.of(), - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("invoice_pdf") + @JsonProperty("eligible_to_issue_at") @ExcludeMissing - private val invoicePdf: JsonField = JsonMissing.of(), + private val eligibleToIssueAt: JsonField = JsonMissing.of(), + @JsonProperty("hosted_invoice_url") + @ExcludeMissing + private val hostedInvoiceUrl: JsonField = JsonMissing.of(), + @JsonProperty("invoice_date") + @ExcludeMissing + private val invoiceDate: JsonField = JsonMissing.of(), @JsonProperty("invoice_number") @ExcludeMissing private val invoiceNumber: JsonField = JsonMissing.of(), - @JsonProperty("minimum") + @JsonProperty("invoice_pdf") @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") + private val invoicePdf: JsonField = JsonMissing.of(), + @JsonProperty("invoice_source") @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), + private val invoiceSource: JsonField = JsonMissing.of(), + @JsonProperty("issue_failed_at") + @ExcludeMissing + private val issueFailedAt: JsonField = JsonMissing.of(), + @JsonProperty("issued_at") + @ExcludeMissing + private val issuedAt: JsonField = JsonMissing.of(), + @JsonProperty("line_items") + @ExcludeMissing + private val lineItems: JsonField> = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("line_items") + @JsonProperty("memo") @ExcludeMissing private val memo: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val lineItems: JsonField> = JsonMissing.of(), - @JsonProperty("subscription") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum") @ExcludeMissing - private val subscription: JsonField = JsonMissing.of(), - @JsonProperty("subtotal") + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") @ExcludeMissing - private val subtotal: JsonField = JsonMissing.of(), - @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), - @JsonProperty("customer_balance_transactions") + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("paid_at") @ExcludeMissing - private val customerBalanceTransactions: JsonField> = - JsonMissing.of(), - @JsonProperty("status") + private val paidAt: JsonField = JsonMissing.of(), + @JsonProperty("payment_attempts") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("invoice_source") + private val paymentAttempts: JsonField> = JsonMissing.of(), + @JsonProperty("payment_failed_at") @ExcludeMissing - private val invoiceSource: JsonField = JsonMissing.of(), - @JsonProperty("shipping_address") + private val paymentFailedAt: JsonField = JsonMissing.of(), + @JsonProperty("payment_started_at") @ExcludeMissing - private val shippingAddress: JsonField = JsonMissing.of(), - @JsonProperty("billing_address") + private val paymentStartedAt: JsonField = JsonMissing.of(), + @JsonProperty("scheduled_issue_at") @ExcludeMissing - private val billingAddress: JsonField = JsonMissing.of(), - @JsonProperty("hosted_invoice_url") + private val scheduledIssueAt: JsonField = JsonMissing.of(), + @JsonProperty("shipping_address") @ExcludeMissing - private val hostedInvoiceUrl: JsonField = JsonMissing.of(), - @JsonProperty("will_auto_issue") + private val shippingAddress: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val willAutoIssue: JsonField = JsonMissing.of(), - @JsonProperty("eligible_to_issue_at") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("subscription") @ExcludeMissing - private val eligibleToIssueAt: JsonField = JsonMissing.of(), - @JsonProperty("customer_tax_id") + private val subscription: JsonField = JsonMissing.of(), + @JsonProperty("subtotal") @ExcludeMissing - private val customerTaxId: JsonField = JsonMissing.of(), - @JsonProperty("memo") @ExcludeMissing private val memo: JsonField = JsonMissing.of(), - @JsonProperty("credit_notes") + private val subtotal: JsonField = JsonMissing.of(), + @JsonProperty("sync_failed_at") @ExcludeMissing - private val creditNotes: JsonField> = JsonMissing.of(), - @JsonProperty("payment_attempts") + private val syncFailedAt: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), + @JsonProperty("voided_at") @ExcludeMissing - private val paymentAttempts: JsonField> = JsonMissing.of(), - @JsonProperty("invoice_date") + private val voidedAt: JsonField = JsonMissing.of(), + @JsonProperty("will_auto_issue") @ExcludeMissing - private val invoiceDate: JsonField = JsonMissing.of(), + private val willAutoIssue: 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") - - /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. - */ - fun voidedAt(): Optional = - Optional.ofNullable(voidedAt.getNullable("voided_at")) - - /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ - fun paidAt(): Optional = Optional.ofNullable(paidAt.getNullable("paid_at")) - - /** - * If the invoice has been issued, this will be the time it transitioned to `issued` (even if it - * is now in a different state.) - */ - fun issuedAt(): Optional = - Optional.ofNullable(issuedAt.getNullable("issued_at")) - - /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be - * issued. - */ - fun scheduledIssueAt(): Optional = - Optional.ofNullable(scheduledIssueAt.getNullable("scheduled_issue_at")) - - fun autoCollection(): AutoCollection = autoCollection.getRequired("auto_collection") - - /** - * If the invoice failed to issue, this will be the last time it failed to issue (even if it is - * now in a different state.) - */ - fun issueFailedAt(): Optional = - Optional.ofNullable(issueFailedAt.getNullable("issue_failed_at")) - - /** - * If the invoice failed to sync, this will be the last time an external invoicing provider sync - * was attempted. This field will always be `null` for invoices using Orb Invoicing. - */ - fun syncFailedAt(): Optional = - Optional.ofNullable(syncFailedAt.getNullable("sync_failed_at")) - - /** - * If payment was attempted on this invoice but failed, this will be the time of the most recent - * attempt. - */ - fun paymentFailedAt(): Optional = - Optional.ofNullable(paymentFailedAt.getNullable("payment_failed_at")) - - /** - * If payment was attempted on this invoice, this will be the start time of the most recent - * attempt. This field is especially useful for delayed-notification payment mechanisms (like - * bank transfers), where payment can take 3 days or more. - */ - fun paymentStartedAt(): Optional = - Optional.ofNullable(paymentStartedAt.getNullable("payment_started_at")) + fun id(): String = id.getRequired("id") /** * This is the final amount required to be charged to the customer and reflects the application @@ -227,87 +168,25 @@ private constructor( */ fun amountDue(): String = amountDue.getRequired("amount_due") + fun autoCollection(): AutoCollection = autoCollection.getRequired("auto_collection") + + fun billingAddress(): Optional = + Optional.ofNullable(billingAddress.getNullable("billing_address")) + /** The creation time of the resource in Orb. */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + /** A list of credit notes associated with the invoice */ + fun creditNotes(): List = creditNotes.getRequired("credit_notes") + /** An ISO 4217 currency string or `credits` */ fun currency(): String = currency.getRequired("currency") fun customer(): Customer = customer.getRequired("customer") - fun discounts(): List = discounts.getRequired("discounts") - - /** - * When the invoice payment is due. The due date is null if the invoice is not yet finalized. - */ - fun dueDate(): Optional = Optional.ofNullable(dueDate.getNullable("due_date")) - - fun id(): String = id.getRequired("id") - - /** The link to download the PDF representation of the `Invoice`. */ - fun invoicePdf(): Optional = Optional.ofNullable(invoicePdf.getNullable("invoice_pdf")) - - /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers - * have a prefix such as `RFOBWG`. These can be sequential per account or customer. - */ - fun invoiceNumber(): String = invoiceNumber.getRequired("invoice_number") - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) - - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - - /** The breakdown of prices in this invoice. */ - fun lineItems(): List = lineItems.getRequired("line_items") - - fun subscription(): Optional = - Optional.ofNullable(subscription.getNullable("subscription")) - - /** The total before any discounts and minimums are applied. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** The total after any minimums and discounts have been applied. */ - fun total(): String = total.getRequired("total") - fun customerBalanceTransactions(): List = customerBalanceTransactions.getRequired("customer_balance_transactions") - fun status(): Status = status.getRequired("status") - - fun invoiceSource(): InvoiceSource = invoiceSource.getRequired("invoice_source") - - fun shippingAddress(): Optional = - Optional.ofNullable(shippingAddress.getNullable("shipping_address")) - - fun billingAddress(): Optional = - Optional.ofNullable(billingAddress.getNullable("billing_address")) - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's - * due date, or 60 days after being re-generated through the UI. - */ - fun hostedInvoiceUrl(): Optional = - Optional.ofNullable(hostedInvoiceUrl.getNullable("hosted_invoice_url")) - - /** - * This is true if the invoice will be automatically issued in the future, and false otherwise. - */ - fun willAutoIssue(): Boolean = willAutoIssue.getRequired("will_auto_issue") - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will - * automatically begin issuing at this time. - */ - fun eligibleToIssueAt(): Optional = - Optional.ofNullable(eligibleToIssueAt.getNullable("eligible_to_issue_at")) - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to the * headers of invoices. @@ -417,161 +296,164 @@ private constructor( fun customerTaxId(): Optional = Optional.ofNullable(customerTaxId.getNullable("customer_tax_id")) - /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ - fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) + fun discounts(): List = discounts.getRequired("discounts") - /** A list of credit notes associated with the invoice */ - fun creditNotes(): List = creditNotes.getRequired("credit_notes") + /** When the invoice payment is due. */ + fun dueDate(): OffsetDateTime = dueDate.getRequired("due_date") - /** A list of payment attempts associated with the invoice */ - fun paymentAttempts(): List = paymentAttempts.getRequired("payment_attempts") + /** + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will + * automatically begin issuing at this time. + */ + fun eligibleToIssueAt(): Optional = + Optional.ofNullable(eligibleToIssueAt.getNullable("eligible_to_issue_at")) + + /** + * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's + * due date, or 60 days after being re-generated through the UI. + */ + fun hostedInvoiceUrl(): Optional = + Optional.ofNullable(hostedInvoiceUrl.getNullable("hosted_invoice_url")) /** The scheduled date of the invoice */ fun invoiceDate(): OffsetDateTime = invoiceDate.getRequired("invoice_date") /** - * 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`. + * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers + * have a prefix such as `RFOBWG`. These can be sequential per account or customer. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + fun invoiceNumber(): String = invoiceNumber.getRequired("invoice_number") + + /** The link to download the PDF representation of the `Invoice`. */ + fun invoicePdf(): Optional = Optional.ofNullable(invoicePdf.getNullable("invoice_pdf")) + + fun invoiceSource(): InvoiceSource = invoiceSource.getRequired("invoice_source") /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. + * If the invoice failed to issue, this will be the last time it failed to issue (even if it is + * now in a different state.) */ - @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt - - /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ - @JsonProperty("paid_at") @ExcludeMissing fun _paidAt() = paidAt + fun issueFailedAt(): Optional = + Optional.ofNullable(issueFailedAt.getNullable("issue_failed_at")) /** * If the invoice has been issued, this will be the time it transitioned to `issued` (even if it * is now in a different state.) */ - @JsonProperty("issued_at") @ExcludeMissing fun _issuedAt() = issuedAt + fun issuedAt(): Optional = + Optional.ofNullable(issuedAt.getNullable("issued_at")) - /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be - * issued. - */ - @JsonProperty("scheduled_issue_at") @ExcludeMissing fun _scheduledIssueAt() = scheduledIssueAt + /** The breakdown of prices in this invoice. */ + fun lineItems(): List = lineItems.getRequired("line_items") - @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) - /** - * If the invoice failed to issue, this will be the last time it failed to issue (even if it is - * now in a different state.) - */ - @JsonProperty("issue_failed_at") @ExcludeMissing fun _issueFailedAt() = issueFailedAt + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ + fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) /** - * If the invoice failed to sync, this will be the last time an external invoicing provider sync - * was attempted. This field will always be `null` for invoices using Orb Invoicing. + * 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("sync_failed_at") @ExcludeMissing fun _syncFailedAt() = syncFailedAt + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ + fun paidAt(): Optional = Optional.ofNullable(paidAt.getNullable("paid_at")) + + /** A list of payment attempts associated with the invoice */ + fun paymentAttempts(): List = paymentAttempts.getRequired("payment_attempts") /** * If payment was attempted on this invoice but failed, this will be the time of the most recent * attempt. */ - @JsonProperty("payment_failed_at") @ExcludeMissing fun _paymentFailedAt() = paymentFailedAt + fun paymentFailedAt(): Optional = + Optional.ofNullable(paymentFailedAt.getNullable("payment_failed_at")) /** * If payment was attempted on this invoice, this will be the start time of the most recent * attempt. This field is especially useful for delayed-notification payment mechanisms (like * bank transfers), where payment can take 3 days or more. */ - @JsonProperty("payment_started_at") @ExcludeMissing fun _paymentStartedAt() = paymentStartedAt + fun paymentStartedAt(): Optional = + Optional.ofNullable(paymentStartedAt.getNullable("payment_started_at")) /** - * This is the final amount required to be charged to the customer and reflects the application - * of the customer balance to the `total` of the invoice. + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be + * issued. */ - @JsonProperty("amount_due") @ExcludeMissing fun _amountDue() = amountDue + fun scheduledIssueAt(): Optional = + Optional.ofNullable(scheduledIssueAt.getNullable("scheduled_issue_at")) - /** The creation time of the resource in Orb. */ - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun shippingAddress(): Optional = + Optional.ofNullable(shippingAddress.getNullable("shipping_address")) - /** An ISO 4217 currency string or `credits` */ - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun status(): Status = status.getRequired("status") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun subscription(): Optional = + Optional.ofNullable(subscription.getNullable("subscription")) + + /** The total before any discounts and minimums are applied. */ + fun subtotal(): String = subtotal.getRequired("subtotal") /** - * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the - * first discount in the list will be returned. If the list is empty, `None` will be returned. + * If the invoice failed to sync, this will be the last time an external invoicing provider sync + * was attempted. This field will always be `null` for invoices using Orb Invoicing. */ - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + fun syncFailedAt(): Optional = + Optional.ofNullable(syncFailedAt.getNullable("sync_failed_at")) - @JsonProperty("discounts") @ExcludeMissing fun _discounts() = discounts + /** The total after any minimums and discounts have been applied. */ + fun total(): String = total.getRequired("total") /** - * When the invoice payment is due. The due date is null if the invoice is not yet finalized. + * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. */ - @JsonProperty("due_date") @ExcludeMissing fun _dueDate() = dueDate - - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The link to download the PDF representation of the `Invoice`. */ - @JsonProperty("invoice_pdf") @ExcludeMissing fun _invoicePdf() = invoicePdf + fun voidedAt(): Optional = + Optional.ofNullable(voidedAt.getNullable("voided_at")) /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers - * have a prefix such as `RFOBWG`. These can be sequential per account or customer. + * This is true if the invoice will be automatically issued in the future, and false otherwise. */ - @JsonProperty("invoice_number") @ExcludeMissing fun _invoiceNumber() = invoiceNumber + fun willAutoIssue(): Boolean = willAutoIssue.getRequired("will_auto_issue") - @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** + * This is the final amount required to be charged to the customer and reflects the application + * of the customer balance to the `total` of the invoice. + */ + @JsonProperty("amount_due") @ExcludeMissing fun _amountDue() = amountDue - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("billing_address") @ExcludeMissing fun _billingAddress() = billingAddress - /** The breakdown of prices in this invoice. */ - @JsonProperty("line_items") @ExcludeMissing fun _lineItems() = lineItems + /** The creation time of the resource in Orb. */ + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("subscription") @ExcludeMissing fun _subscription() = subscription + /** A list of credit notes associated with the invoice */ + @JsonProperty("credit_notes") @ExcludeMissing fun _creditNotes() = creditNotes - /** The total before any discounts and minimums are applied. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + /** An ISO 4217 currency string or `credits` */ + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - /** The total after any minimums and discounts have been applied. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("customer_balance_transactions") @ExcludeMissing fun _customerBalanceTransactions() = customerBalanceTransactions - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("invoice_source") @ExcludeMissing fun _invoiceSource() = invoiceSource - - @JsonProperty("shipping_address") @ExcludeMissing fun _shippingAddress() = shippingAddress - - @JsonProperty("billing_address") @ExcludeMissing fun _billingAddress() = billingAddress - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's - * due date, or 60 days after being re-generated through the UI. - */ - @JsonProperty("hosted_invoice_url") @ExcludeMissing fun _hostedInvoiceUrl() = hostedInvoiceUrl - - /** - * This is true if the invoice will be automatically issued in the future, and false otherwise. - */ - @JsonProperty("will_auto_issue") @ExcludeMissing fun _willAutoIssue() = willAutoIssue - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will - * automatically begin issuing at this time. - */ - @JsonProperty("eligible_to_issue_at") - @ExcludeMissing - fun _eligibleToIssueAt() = eligibleToIssueAt - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to the * headers of invoices. @@ -680,66 +562,180 @@ private constructor( */ @JsonProperty("customer_tax_id") @ExcludeMissing fun _customerTaxId() = customerTaxId - /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ - @JsonProperty("memo") @ExcludeMissing fun _memo() = memo + /** + * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the + * first discount in the list will be returned. If the list is empty, `None` will be returned. + */ + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount - /** A list of credit notes associated with the invoice */ - @JsonProperty("credit_notes") @ExcludeMissing fun _creditNotes() = creditNotes + @JsonProperty("discounts") @ExcludeMissing fun _discounts() = discounts - /** A list of payment attempts associated with the invoice */ - @JsonProperty("payment_attempts") @ExcludeMissing fun _paymentAttempts() = paymentAttempts + /** When the invoice payment is due. */ + @JsonProperty("due_date") @ExcludeMissing fun _dueDate() = dueDate + + /** + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will + * automatically begin issuing at this time. + */ + @JsonProperty("eligible_to_issue_at") + @ExcludeMissing + fun _eligibleToIssueAt() = eligibleToIssueAt + + /** + * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's + * due date, or 60 days after being re-generated through the UI. + */ + @JsonProperty("hosted_invoice_url") @ExcludeMissing fun _hostedInvoiceUrl() = hostedInvoiceUrl /** The scheduled date of the invoice */ @JsonProperty("invoice_date") @ExcludeMissing fun _invoiceDate() = invoiceDate - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers + * have a prefix such as `RFOBWG`. These can be sequential per account or customer. + */ + @JsonProperty("invoice_number") @ExcludeMissing fun _invoiceNumber() = invoiceNumber - private var validated: Boolean = false + /** The link to download the PDF representation of the `Invoice`. */ + @JsonProperty("invoice_pdf") @ExcludeMissing fun _invoicePdf() = invoicePdf - fun validate(): Invoice = apply { - if (!validated) { - metadata().validate() - voidedAt() - paidAt() - issuedAt() - scheduledIssueAt() - autoCollection().validate() - issueFailedAt() - syncFailedAt() - paymentFailedAt() - paymentStartedAt() - amountDue() - createdAt() + @JsonProperty("invoice_source") @ExcludeMissing fun _invoiceSource() = invoiceSource + + /** + * If the invoice failed to issue, this will be the last time it failed to issue (even if it is + * now in a different state.) + */ + @JsonProperty("issue_failed_at") @ExcludeMissing fun _issueFailedAt() = issueFailedAt + + /** + * If the invoice has been issued, this will be the time it transitioned to `issued` (even if it + * is now in a different state.) + */ + @JsonProperty("issued_at") @ExcludeMissing fun _issuedAt() = issuedAt + + /** The breakdown of prices in this invoice. */ + @JsonProperty("line_items") @ExcludeMissing fun _lineItems() = lineItems + + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ + @JsonProperty("memo") @ExcludeMissing fun _memo() = memo + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum + + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + + /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ + @JsonProperty("paid_at") @ExcludeMissing fun _paidAt() = paidAt + + /** A list of payment attempts associated with the invoice */ + @JsonProperty("payment_attempts") @ExcludeMissing fun _paymentAttempts() = paymentAttempts + + /** + * If payment was attempted on this invoice but failed, this will be the time of the most recent + * attempt. + */ + @JsonProperty("payment_failed_at") @ExcludeMissing fun _paymentFailedAt() = paymentFailedAt + + /** + * If payment was attempted on this invoice, this will be the start time of the most recent + * attempt. This field is especially useful for delayed-notification payment mechanisms (like + * bank transfers), where payment can take 3 days or more. + */ + @JsonProperty("payment_started_at") @ExcludeMissing fun _paymentStartedAt() = paymentStartedAt + + /** + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be + * issued. + */ + @JsonProperty("scheduled_issue_at") @ExcludeMissing fun _scheduledIssueAt() = scheduledIssueAt + + @JsonProperty("shipping_address") @ExcludeMissing fun _shippingAddress() = shippingAddress + + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("subscription") @ExcludeMissing fun _subscription() = subscription + + /** The total before any discounts and minimums are applied. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** + * If the invoice failed to sync, this will be the last time an external invoicing provider sync + * was attempted. This field will always be `null` for invoices using Orb Invoicing. + */ + @JsonProperty("sync_failed_at") @ExcludeMissing fun _syncFailedAt() = syncFailedAt + + /** The total after any minimums and discounts have been applied. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total + + /** + * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. + */ + @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt + + /** + * This is true if the invoice will be automatically issued in the future, and false otherwise. + */ + @JsonProperty("will_auto_issue") @ExcludeMissing fun _willAutoIssue() = willAutoIssue + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Invoice = apply { + if (!validated) { + id() + amountDue() + autoCollection().validate() + billingAddress().map { it.validate() } + createdAt() + creditNotes().forEach { it.validate() } currency() customer().validate() + customerBalanceTransactions().forEach { it.validate() } + customerTaxId().map { it.validate() } discounts() dueDate() - id() - invoicePdf() + eligibleToIssueAt() + hostedInvoiceUrl() + invoiceDate() invoiceNumber() - minimum().map { it.validate() } - minimumAmount() + invoicePdf() + invoiceSource() + issueFailedAt() + issuedAt() + lineItems().forEach { it.validate() } maximum().map { it.validate() } maximumAmount() - lineItems().forEach { it.validate() } + memo() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + paidAt() + paymentAttempts().forEach { it.validate() } + paymentFailedAt() + paymentStartedAt() + scheduledIssueAt() + shippingAddress().map { it.validate() } + status() subscription().map { it.validate() } subtotal() + syncFailedAt() total() - customerBalanceTransactions().forEach { it.validate() } - status() - invoiceSource() - shippingAddress().map { it.validate() } - billingAddress().map { it.validate() } - hostedInvoiceUrl() + voidedAt() willAutoIssue() - eligibleToIssueAt() - customerTaxId().map { it.validate() } - memo() - creditNotes().forEach { it.validate() } - paymentAttempts().forEach { it.validate() } - invoiceDate() validated = true } } @@ -753,158 +749,111 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() - private var voidedAt: JsonField = JsonMissing.of() - private var paidAt: JsonField = JsonMissing.of() - private var issuedAt: JsonField = JsonMissing.of() - private var scheduledIssueAt: JsonField = JsonMissing.of() - private var autoCollection: JsonField = JsonMissing.of() - private var issueFailedAt: JsonField = JsonMissing.of() - private var syncFailedAt: JsonField = JsonMissing.of() - private var paymentFailedAt: JsonField = JsonMissing.of() - private var paymentStartedAt: JsonField = JsonMissing.of() + private var id: JsonField = JsonMissing.of() private var amountDue: JsonField = JsonMissing.of() + private var autoCollection: JsonField = JsonMissing.of() + private var billingAddress: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() + private var creditNotes: JsonField> = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var customer: JsonField = JsonMissing.of() + private var customerBalanceTransactions: JsonField> = + JsonMissing.of() + private var customerTaxId: JsonField = JsonMissing.of() private var discount: JsonValue = JsonMissing.of() private var discounts: JsonField> = JsonMissing.of() private var dueDate: JsonField = JsonMissing.of() - private var id: JsonField = JsonMissing.of() - private var invoicePdf: JsonField = JsonMissing.of() + private var eligibleToIssueAt: JsonField = JsonMissing.of() + private var hostedInvoiceUrl: JsonField = JsonMissing.of() + private var invoiceDate: JsonField = JsonMissing.of() private var invoiceNumber: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var invoicePdf: JsonField = JsonMissing.of() + private var invoiceSource: JsonField = JsonMissing.of() + private var issueFailedAt: JsonField = JsonMissing.of() + private var issuedAt: JsonField = JsonMissing.of() + private var lineItems: JsonField> = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var lineItems: JsonField> = JsonMissing.of() + private var memo: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var paidAt: JsonField = JsonMissing.of() + private var paymentAttempts: JsonField> = JsonMissing.of() + private var paymentFailedAt: JsonField = JsonMissing.of() + private var paymentStartedAt: JsonField = JsonMissing.of() + private var scheduledIssueAt: JsonField = JsonMissing.of() + private var shippingAddress: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() private var subscription: JsonField = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() + private var syncFailedAt: JsonField = JsonMissing.of() private var total: JsonField = JsonMissing.of() - private var customerBalanceTransactions: JsonField> = - JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var invoiceSource: JsonField = JsonMissing.of() - private var shippingAddress: JsonField = JsonMissing.of() - private var billingAddress: JsonField = JsonMissing.of() - private var hostedInvoiceUrl: JsonField = JsonMissing.of() + private var voidedAt: JsonField = JsonMissing.of() private var willAutoIssue: JsonField = JsonMissing.of() - private var eligibleToIssueAt: JsonField = JsonMissing.of() - private var customerTaxId: JsonField = JsonMissing.of() - private var memo: JsonField = JsonMissing.of() - private var creditNotes: JsonField> = JsonMissing.of() - private var paymentAttempts: JsonField> = JsonMissing.of() - private var invoiceDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoice: Invoice) = apply { - metadata = invoice.metadata - voidedAt = invoice.voidedAt - paidAt = invoice.paidAt - issuedAt = invoice.issuedAt - scheduledIssueAt = invoice.scheduledIssueAt - autoCollection = invoice.autoCollection - issueFailedAt = invoice.issueFailedAt - syncFailedAt = invoice.syncFailedAt - paymentFailedAt = invoice.paymentFailedAt - paymentStartedAt = invoice.paymentStartedAt + id = invoice.id amountDue = invoice.amountDue + autoCollection = invoice.autoCollection + billingAddress = invoice.billingAddress createdAt = invoice.createdAt + creditNotes = invoice.creditNotes currency = invoice.currency customer = invoice.customer + customerBalanceTransactions = invoice.customerBalanceTransactions + customerTaxId = invoice.customerTaxId discount = invoice.discount discounts = invoice.discounts dueDate = invoice.dueDate - id = invoice.id - invoicePdf = invoice.invoicePdf + eligibleToIssueAt = invoice.eligibleToIssueAt + hostedInvoiceUrl = invoice.hostedInvoiceUrl + invoiceDate = invoice.invoiceDate invoiceNumber = invoice.invoiceNumber - minimum = invoice.minimum - minimumAmount = invoice.minimumAmount + invoicePdf = invoice.invoicePdf + invoiceSource = invoice.invoiceSource + issueFailedAt = invoice.issueFailedAt + issuedAt = invoice.issuedAt + lineItems = invoice.lineItems maximum = invoice.maximum maximumAmount = invoice.maximumAmount - lineItems = invoice.lineItems + memo = invoice.memo + metadata = invoice.metadata + minimum = invoice.minimum + minimumAmount = invoice.minimumAmount + paidAt = invoice.paidAt + paymentAttempts = invoice.paymentAttempts + paymentFailedAt = invoice.paymentFailedAt + paymentStartedAt = invoice.paymentStartedAt + scheduledIssueAt = invoice.scheduledIssueAt + shippingAddress = invoice.shippingAddress + status = invoice.status subscription = invoice.subscription subtotal = invoice.subtotal + syncFailedAt = invoice.syncFailedAt total = invoice.total - customerBalanceTransactions = invoice.customerBalanceTransactions - status = invoice.status - invoiceSource = invoice.invoiceSource - shippingAddress = invoice.shippingAddress - billingAddress = invoice.billingAddress - hostedInvoiceUrl = invoice.hostedInvoiceUrl + voidedAt = invoice.voidedAt willAutoIssue = invoice.willAutoIssue - eligibleToIssueAt = invoice.eligibleToIssueAt - customerTaxId = invoice.customerTaxId - memo = invoice.memo - creditNotes = invoice.creditNotes - paymentAttempts = invoice.paymentAttempts - invoiceDate = invoice.invoiceDate additionalProperties = invoice.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + /** - * 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 } - - /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was - * voided. - */ - fun voidedAt(voidedAt: OffsetDateTime) = voidedAt(JsonField.of(voidedAt)) - - /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was - * voided. - */ - fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt } - - /** - * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. - */ - fun paidAt(paidAt: OffsetDateTime) = paidAt(JsonField.of(paidAt)) - - /** - * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. - */ - fun paidAt(paidAt: JsonField) = apply { this.paidAt = paidAt } - - /** - * If the invoice has been issued, this will be the time it transitioned to `issued` (even - * if it is now in a different state.) - */ - fun issuedAt(issuedAt: OffsetDateTime) = issuedAt(JsonField.of(issuedAt)) - - /** - * If the invoice has been issued, this will be the time it transitioned to `issued` (even - * if it is now in a different state.) - */ - fun issuedAt(issuedAt: JsonField) = apply { this.issuedAt = issuedAt } - - /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to - * be issued. + * This is the final amount required to be charged to the customer and reflects the + * application of the customer balance to the `total` of the invoice. */ - fun scheduledIssueAt(scheduledIssueAt: OffsetDateTime) = - scheduledIssueAt(JsonField.of(scheduledIssueAt)) + fun amountDue(amountDue: String) = amountDue(JsonField.of(amountDue)) /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to - * be issued. + * This is the final amount required to be charged to the customer and reflects the + * application of the customer balance to the `total` of the invoice. */ - fun scheduledIssueAt(scheduledIssueAt: JsonField) = apply { - this.scheduledIssueAt = scheduledIssueAt - } + fun amountDue(amountDue: JsonField) = apply { this.amountDue = amountDue } fun autoCollection(autoCollection: AutoCollection) = autoCollection(JsonField.of(autoCollection)) @@ -913,85 +862,27 @@ private constructor( this.autoCollection = autoCollection } - /** - * If the invoice failed to issue, this will be the last time it failed to issue (even if it - * is now in a different state.) - */ - fun issueFailedAt(issueFailedAt: OffsetDateTime) = - issueFailedAt(JsonField.of(issueFailedAt)) - - /** - * If the invoice failed to issue, this will be the last time it failed to issue (even if it - * is now in a different state.) - */ - fun issueFailedAt(issueFailedAt: JsonField) = apply { - this.issueFailedAt = issueFailedAt - } - - /** - * If the invoice failed to sync, this will be the last time an external invoicing provider - * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. - */ - fun syncFailedAt(syncFailedAt: OffsetDateTime) = syncFailedAt(JsonField.of(syncFailedAt)) - - /** - * If the invoice failed to sync, this will be the last time an external invoicing provider - * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. - */ - fun syncFailedAt(syncFailedAt: JsonField) = apply { - this.syncFailedAt = syncFailedAt - } - - /** - * If payment was attempted on this invoice but failed, this will be the time of the most - * recent attempt. - */ - fun paymentFailedAt(paymentFailedAt: OffsetDateTime) = - paymentFailedAt(JsonField.of(paymentFailedAt)) - - /** - * If payment was attempted on this invoice but failed, this will be the time of the most - * recent attempt. - */ - fun paymentFailedAt(paymentFailedAt: JsonField) = apply { - this.paymentFailedAt = paymentFailedAt - } - - /** - * If payment was attempted on this invoice, this will be the start time of the most recent - * attempt. This field is especially useful for delayed-notification payment mechanisms - * (like bank transfers), where payment can take 3 days or more. - */ - fun paymentStartedAt(paymentStartedAt: OffsetDateTime) = - paymentStartedAt(JsonField.of(paymentStartedAt)) + fun billingAddress(billingAddress: BillingAddress) = + billingAddress(JsonField.of(billingAddress)) - /** - * If payment was attempted on this invoice, this will be the start time of the most recent - * attempt. This field is especially useful for delayed-notification payment mechanisms - * (like bank transfers), where payment can take 3 days or more. - */ - fun paymentStartedAt(paymentStartedAt: JsonField) = apply { - this.paymentStartedAt = paymentStartedAt + fun billingAddress(billingAddress: JsonField) = apply { + this.billingAddress = billingAddress } - /** - * This is the final amount required to be charged to the customer and reflects the - * application of the customer balance to the `total` of the invoice. - */ - fun amountDue(amountDue: String) = amountDue(JsonField.of(amountDue)) - - /** - * This is the final amount required to be charged to the customer and reflects the - * application of the customer balance to the `total` of the invoice. - */ - fun amountDue(amountDue: JsonField) = apply { this.amountDue = amountDue } - /** 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 } + /** A list of credit notes associated with the invoice */ + fun creditNotes(creditNotes: List) = creditNotes(JsonField.of(creditNotes)) + + /** A list of credit notes associated with the invoice */ + fun creditNotes(creditNotes: JsonField>) = apply { + this.creditNotes = creditNotes + } + /** An ISO 4217 currency string or `credits` */ fun currency(currency: String) = currency(JsonField.of(currency)) @@ -1002,99 +893,6 @@ private constructor( fun customer(customer: JsonField) = apply { this.customer = customer } - /** - * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the - * first discount in the list will be returned. If the list is empty, `None` will be - * returned. - */ - fun discount(discount: JsonValue) = apply { this.discount = discount } - - fun discounts(discounts: List) = discounts(JsonField.of(discounts)) - - fun discounts(discounts: JsonField>) = apply { - this.discounts = discounts - } - - /** - * When the invoice payment is due. The due date is null if the invoice is not yet - * finalized. - */ - fun dueDate(dueDate: OffsetDateTime) = dueDate(JsonField.of(dueDate)) - - /** - * When the invoice payment is due. The due date is null if the invoice is not yet - * finalized. - */ - fun dueDate(dueDate: JsonField) = apply { this.dueDate = dueDate } - - fun id(id: String) = id(JsonField.of(id)) - - fun id(id: JsonField) = apply { this.id = id } - - /** The link to download the PDF representation of the `Invoice`. */ - fun invoicePdf(invoicePdf: String) = invoicePdf(JsonField.of(invoicePdf)) - - /** The link to download the PDF representation of the `Invoice`. */ - fun invoicePdf(invoicePdf: JsonField) = apply { this.invoicePdf = invoicePdf } - - /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice - * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. - */ - fun invoiceNumber(invoiceNumber: String) = invoiceNumber(JsonField.of(invoiceNumber)) - - /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice - * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. - */ - fun invoiceNumber(invoiceNumber: JsonField) = apply { - this.invoiceNumber = invoiceNumber - } - - fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - - fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } - - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - - /** The breakdown of prices in this invoice. */ - fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) - - /** The breakdown of prices in this invoice. */ - fun lineItems(lineItems: JsonField>) = apply { this.lineItems = lineItems } - - fun subscription(subscription: Subscription) = subscription(JsonField.of(subscription)) - - fun subscription(subscription: JsonField) = apply { - this.subscription = subscription - } - - /** The total before any discounts and minimums are applied. */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** The total before any discounts and minimums are applied. */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** The total after any minimums and discounts have been applied. */ - fun total(total: String) = total(JsonField.of(total)) - - /** The total after any minimums and discounts have been applied. */ - fun total(total: JsonField) = apply { this.total = total } - fun customerBalanceTransactions( customerBalanceTransactions: List ) = customerBalanceTransactions(JsonField.of(customerBalanceTransactions)) @@ -1103,76 +901,6 @@ private constructor( customerBalanceTransactions: JsonField> ) = apply { this.customerBalanceTransactions = customerBalanceTransactions } - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } - - fun invoiceSource(invoiceSource: InvoiceSource) = invoiceSource(JsonField.of(invoiceSource)) - - fun invoiceSource(invoiceSource: JsonField) = apply { - this.invoiceSource = invoiceSource - } - - fun shippingAddress(shippingAddress: ShippingAddress) = - shippingAddress(JsonField.of(shippingAddress)) - - fun shippingAddress(shippingAddress: JsonField) = apply { - this.shippingAddress = shippingAddress - } - - fun billingAddress(billingAddress: BillingAddress) = - billingAddress(JsonField.of(billingAddress)) - - fun billingAddress(billingAddress: JsonField) = apply { - this.billingAddress = billingAddress - } - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the - * invoice's due date, or 60 days after being re-generated through the UI. - */ - fun hostedInvoiceUrl(hostedInvoiceUrl: String) = - hostedInvoiceUrl(JsonField.of(hostedInvoiceUrl)) - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the - * invoice's due date, or 60 days after being re-generated through the UI. - */ - fun hostedInvoiceUrl(hostedInvoiceUrl: JsonField) = apply { - this.hostedInvoiceUrl = hostedInvoiceUrl - } - - /** - * This is true if the invoice will be automatically issued in the future, and false - * otherwise. - */ - fun willAutoIssue(willAutoIssue: Boolean) = willAutoIssue(JsonField.of(willAutoIssue)) - - /** - * This is true if the invoice will be automatically issued in the future, and false - * otherwise. - */ - fun willAutoIssue(willAutoIssue: JsonField) = apply { - this.willAutoIssue = willAutoIssue - } - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice - * will automatically begin issuing at this time. - */ - fun eligibleToIssueAt(eligibleToIssueAt: OffsetDateTime) = - eligibleToIssueAt(JsonField.of(eligibleToIssueAt)) - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice - * will automatically begin issuing at this time. - */ - fun eligibleToIssueAt(eligibleToIssueAt: JsonField) = apply { - this.eligibleToIssueAt = eligibleToIssueAt - } - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to * the headers of invoices. @@ -1387,8 +1115,136 @@ private constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun customerTaxId(customerTaxId: JsonField) = apply { - this.customerTaxId = customerTaxId + fun customerTaxId(customerTaxId: JsonField) = apply { + this.customerTaxId = customerTaxId + } + + /** + * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the + * first discount in the list will be returned. If the list is empty, `None` will be + * returned. + */ + fun discount(discount: JsonValue) = apply { this.discount = discount } + + fun discounts(discounts: List) = discounts(JsonField.of(discounts)) + + fun discounts(discounts: JsonField>) = apply { + this.discounts = discounts + } + + /** When the invoice payment is due. */ + fun dueDate(dueDate: OffsetDateTime) = dueDate(JsonField.of(dueDate)) + + /** When the invoice payment is due. */ + fun dueDate(dueDate: JsonField) = apply { this.dueDate = dueDate } + + /** + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice + * will automatically begin issuing at this time. + */ + fun eligibleToIssueAt(eligibleToIssueAt: OffsetDateTime) = + eligibleToIssueAt(JsonField.of(eligibleToIssueAt)) + + /** + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice + * will automatically begin issuing at this time. + */ + fun eligibleToIssueAt(eligibleToIssueAt: JsonField) = apply { + this.eligibleToIssueAt = eligibleToIssueAt + } + + /** + * A URL for the customer-facing invoice portal. This URL expires 30 days after the + * invoice's due date, or 60 days after being re-generated through the UI. + */ + fun hostedInvoiceUrl(hostedInvoiceUrl: String) = + hostedInvoiceUrl(JsonField.of(hostedInvoiceUrl)) + + /** + * A URL for the customer-facing invoice portal. This URL expires 30 days after the + * invoice's due date, or 60 days after being re-generated through the UI. + */ + fun hostedInvoiceUrl(hostedInvoiceUrl: JsonField) = apply { + this.hostedInvoiceUrl = hostedInvoiceUrl + } + + /** The scheduled date of the invoice */ + fun invoiceDate(invoiceDate: OffsetDateTime) = invoiceDate(JsonField.of(invoiceDate)) + + /** The scheduled date of the invoice */ + fun invoiceDate(invoiceDate: JsonField) = apply { + this.invoiceDate = invoiceDate + } + + /** + * Automatically generated invoice number to help track and reconcile invoices. Invoice + * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. + */ + fun invoiceNumber(invoiceNumber: String) = invoiceNumber(JsonField.of(invoiceNumber)) + + /** + * Automatically generated invoice number to help track and reconcile invoices. Invoice + * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. + */ + fun invoiceNumber(invoiceNumber: JsonField) = apply { + this.invoiceNumber = invoiceNumber + } + + /** The link to download the PDF representation of the `Invoice`. */ + fun invoicePdf(invoicePdf: String) = invoicePdf(JsonField.of(invoicePdf)) + + /** The link to download the PDF representation of the `Invoice`. */ + fun invoicePdf(invoicePdf: JsonField) = apply { this.invoicePdf = invoicePdf } + + fun invoiceSource(invoiceSource: InvoiceSource) = invoiceSource(JsonField.of(invoiceSource)) + + fun invoiceSource(invoiceSource: JsonField) = apply { + this.invoiceSource = invoiceSource + } + + /** + * If the invoice failed to issue, this will be the last time it failed to issue (even if it + * is now in a different state.) + */ + fun issueFailedAt(issueFailedAt: OffsetDateTime) = + issueFailedAt(JsonField.of(issueFailedAt)) + + /** + * If the invoice failed to issue, this will be the last time it failed to issue (even if it + * is now in a different state.) + */ + fun issueFailedAt(issueFailedAt: JsonField) = apply { + this.issueFailedAt = issueFailedAt + } + + /** + * If the invoice has been issued, this will be the time it transitioned to `issued` (even + * if it is now in a different state.) + */ + fun issuedAt(issuedAt: OffsetDateTime) = issuedAt(JsonField.of(issuedAt)) + + /** + * If the invoice has been issued, this will be the time it transitioned to `issued` (even + * if it is now in a different state.) + */ + fun issuedAt(issuedAt: JsonField) = apply { this.issuedAt = issuedAt } + + /** The breakdown of prices in this invoice. */ + fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) + + /** The breakdown of prices in this invoice. */ + fun lineItems(lineItems: JsonField>) = apply { this.lineItems = lineItems } + + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ @@ -1397,14 +1253,40 @@ private constructor( /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun memo(memo: JsonField) = apply { this.memo = memo } - /** A list of credit notes associated with the invoice */ - fun creditNotes(creditNotes: List) = creditNotes(JsonField.of(creditNotes)) + /** + * 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)) - /** A list of credit notes associated with the invoice */ - fun creditNotes(creditNotes: JsonField>) = apply { - this.creditNotes = creditNotes + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) + + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } + + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount } + /** + * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. + */ + fun paidAt(paidAt: OffsetDateTime) = paidAt(JsonField.of(paidAt)) + + /** + * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. + */ + fun paidAt(paidAt: JsonField) = apply { this.paidAt = paidAt } + /** A list of payment attempts associated with the invoice */ fun paymentAttempts(paymentAttempts: List) = paymentAttempts(JsonField.of(paymentAttempts)) @@ -1414,12 +1296,120 @@ private constructor( this.paymentAttempts = paymentAttempts } - /** The scheduled date of the invoice */ - fun invoiceDate(invoiceDate: OffsetDateTime) = invoiceDate(JsonField.of(invoiceDate)) + /** + * If payment was attempted on this invoice but failed, this will be the time of the most + * recent attempt. + */ + fun paymentFailedAt(paymentFailedAt: OffsetDateTime) = + paymentFailedAt(JsonField.of(paymentFailedAt)) - /** The scheduled date of the invoice */ - fun invoiceDate(invoiceDate: JsonField) = apply { - this.invoiceDate = invoiceDate + /** + * If payment was attempted on this invoice but failed, this will be the time of the most + * recent attempt. + */ + fun paymentFailedAt(paymentFailedAt: JsonField) = apply { + this.paymentFailedAt = paymentFailedAt + } + + /** + * If payment was attempted on this invoice, this will be the start time of the most recent + * attempt. This field is especially useful for delayed-notification payment mechanisms + * (like bank transfers), where payment can take 3 days or more. + */ + fun paymentStartedAt(paymentStartedAt: OffsetDateTime) = + paymentStartedAt(JsonField.of(paymentStartedAt)) + + /** + * If payment was attempted on this invoice, this will be the start time of the most recent + * attempt. This field is especially useful for delayed-notification payment mechanisms + * (like bank transfers), where payment can take 3 days or more. + */ + fun paymentStartedAt(paymentStartedAt: JsonField) = apply { + this.paymentStartedAt = paymentStartedAt + } + + /** + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to + * be issued. + */ + fun scheduledIssueAt(scheduledIssueAt: OffsetDateTime) = + scheduledIssueAt(JsonField.of(scheduledIssueAt)) + + /** + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to + * be issued. + */ + fun scheduledIssueAt(scheduledIssueAt: JsonField) = apply { + this.scheduledIssueAt = scheduledIssueAt + } + + fun shippingAddress(shippingAddress: ShippingAddress) = + shippingAddress(JsonField.of(shippingAddress)) + + fun shippingAddress(shippingAddress: JsonField) = apply { + this.shippingAddress = shippingAddress + } + + fun status(status: Status) = status(JsonField.of(status)) + + fun status(status: JsonField) = apply { this.status = status } + + fun subscription(subscription: Subscription) = subscription(JsonField.of(subscription)) + + fun subscription(subscription: JsonField) = apply { + this.subscription = subscription + } + + /** The total before any discounts and minimums are applied. */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** The total before any discounts and minimums are applied. */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** + * If the invoice failed to sync, this will be the last time an external invoicing provider + * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. + */ + fun syncFailedAt(syncFailedAt: OffsetDateTime) = syncFailedAt(JsonField.of(syncFailedAt)) + + /** + * If the invoice failed to sync, this will be the last time an external invoicing provider + * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. + */ + fun syncFailedAt(syncFailedAt: JsonField) = apply { + this.syncFailedAt = syncFailedAt + } + + /** The total after any minimums and discounts have been applied. */ + fun total(total: String) = total(JsonField.of(total)) + + /** The total after any minimums and discounts have been applied. */ + fun total(total: JsonField) = apply { this.total = total } + + /** + * If the invoice has a status of `void`, this gives a timestamp when the invoice was + * voided. + */ + fun voidedAt(voidedAt: OffsetDateTime) = voidedAt(JsonField.of(voidedAt)) + + /** + * If the invoice has a status of `void`, this gives a timestamp when the invoice was + * voided. + */ + fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt } + + /** + * This is true if the invoice will be automatically issued in the future, and false + * otherwise. + */ + fun willAutoIssue(willAutoIssue: Boolean) = willAutoIssue(JsonField.of(willAutoIssue)) + + /** + * This is true if the invoice will be automatically issued in the future, and false + * otherwise. + */ + fun willAutoIssue(willAutoIssue: JsonField) = apply { + this.willAutoIssue = willAutoIssue } fun additionalProperties(additionalProperties: Map) = apply { @@ -1443,47 +1433,47 @@ private constructor( fun build(): Invoice = Invoice( - metadata, - voidedAt, - paidAt, - issuedAt, - scheduledIssueAt, - autoCollection, - issueFailedAt, - syncFailedAt, - paymentFailedAt, - paymentStartedAt, + id, amountDue, + autoCollection, + billingAddress, createdAt, + creditNotes.map { it.toImmutable() }, currency, customer, + customerBalanceTransactions.map { it.toImmutable() }, + customerTaxId, discount, discounts.map { it.toImmutable() }, dueDate, - id, - invoicePdf, + eligibleToIssueAt, + hostedInvoiceUrl, + invoiceDate, invoiceNumber, - minimum, - minimumAmount, + invoicePdf, + invoiceSource, + issueFailedAt, + issuedAt, + lineItems.map { it.toImmutable() }, maximum, maximumAmount, - lineItems.map { it.toImmutable() }, + memo, + metadata, + minimum, + minimumAmount, + paidAt, + paymentAttempts.map { it.toImmutable() }, + paymentFailedAt, + paymentStartedAt, + scheduledIssueAt, + shippingAddress, + status, subscription, subtotal, + syncFailedAt, total, - customerBalanceTransactions.map { it.toImmutable() }, - status, - invoiceSource, - shippingAddress, - billingAddress, - hostedInvoiceUrl, + voidedAt, willAutoIssue, - eligibleToIssueAt, - customerTaxId, - memo, - creditNotes.map { it.toImmutable() }, - paymentAttempts.map { it.toImmutable() }, - invoiceDate, additionalProperties.toImmutable(), ) } @@ -1492,22 +1482,25 @@ private constructor( class AutoCollection @JsonCreator private constructor( - @JsonProperty("next_attempt_at") - @ExcludeMissing - private val nextAttemptAt: JsonField = JsonMissing.of(), - @JsonProperty("previously_attempted_at") - @ExcludeMissing - private val previouslyAttemptedAt: JsonField = JsonMissing.of(), @JsonProperty("enabled") @ExcludeMissing private val enabled: JsonField = JsonMissing.of(), + @JsonProperty("next_attempt_at") + @ExcludeMissing + private val nextAttemptAt: JsonField = JsonMissing.of(), @JsonProperty("num_attempts") @ExcludeMissing private val numAttempts: JsonField = JsonMissing.of(), + @JsonProperty("previously_attempted_at") + @ExcludeMissing + private val previouslyAttemptedAt: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** True only if auto-collection is enabled for this invoice. */ + fun enabled(): Optional = Optional.ofNullable(enabled.getNullable("enabled")) + /** * If the invoice is scheduled for auto-collection, this field will reflect when the next * attempt will occur. If dunning has been exhausted, or auto-collection is not enabled for @@ -1516,6 +1509,10 @@ private constructor( fun nextAttemptAt(): Optional = Optional.ofNullable(nextAttemptAt.getNullable("next_attempt_at")) + /** Number of auto-collection payment attempts. */ + fun numAttempts(): Optional = + Optional.ofNullable(numAttempts.getNullable("num_attempts")) + /** * If Orb has ever attempted payment auto-collection for this invoice, this field will * reflect when that attempt occurred. In conjunction with `next_attempt_at`, this can be @@ -1528,11 +1525,7 @@ private constructor( Optional.ofNullable(previouslyAttemptedAt.getNullable("previously_attempted_at")) /** True only if auto-collection is enabled for this invoice. */ - fun enabled(): Optional = Optional.ofNullable(enabled.getNullable("enabled")) - - /** Number of auto-collection payment attempts. */ - fun numAttempts(): Optional = - Optional.ofNullable(numAttempts.getNullable("num_attempts")) + @JsonProperty("enabled") @ExcludeMissing fun _enabled() = enabled /** * If the invoice is scheduled for auto-collection, this field will reflect when the next @@ -1541,6 +1534,9 @@ private constructor( */ @JsonProperty("next_attempt_at") @ExcludeMissing fun _nextAttemptAt() = nextAttemptAt + /** Number of auto-collection payment attempts. */ + @JsonProperty("num_attempts") @ExcludeMissing fun _numAttempts() = numAttempts + /** * If Orb has ever attempted payment auto-collection for this invoice, this field will * reflect when that attempt occurred. In conjunction with `next_attempt_at`, this can be @@ -1553,12 +1549,6 @@ private constructor( @ExcludeMissing fun _previouslyAttemptedAt() = previouslyAttemptedAt - /** True only if auto-collection is enabled for this invoice. */ - @JsonProperty("enabled") @ExcludeMissing fun _enabled() = enabled - - /** Number of auto-collection payment attempts. */ - @JsonProperty("num_attempts") @ExcludeMissing fun _numAttempts() = numAttempts - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1567,10 +1557,10 @@ private constructor( fun validate(): AutoCollection = apply { if (!validated) { - nextAttemptAt() - previouslyAttemptedAt() enabled() + nextAttemptAt() numAttempts() + previouslyAttemptedAt() validated = true } } @@ -1584,21 +1574,27 @@ private constructor( class Builder { - private var nextAttemptAt: JsonField = JsonMissing.of() - private var previouslyAttemptedAt: JsonField = JsonMissing.of() private var enabled: JsonField = JsonMissing.of() + private var nextAttemptAt: JsonField = JsonMissing.of() private var numAttempts: JsonField = JsonMissing.of() + private var previouslyAttemptedAt: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(autoCollection: AutoCollection) = apply { - nextAttemptAt = autoCollection.nextAttemptAt - previouslyAttemptedAt = autoCollection.previouslyAttemptedAt enabled = autoCollection.enabled + nextAttemptAt = autoCollection.nextAttemptAt numAttempts = autoCollection.numAttempts + previouslyAttemptedAt = autoCollection.previouslyAttemptedAt additionalProperties = autoCollection.additionalProperties.toMutableMap() } + /** True only if auto-collection is enabled for this invoice. */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** True only if auto-collection is enabled for this invoice. */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + /** * If the invoice is scheduled for auto-collection, this field will reflect when the * next attempt will occur. If dunning has been exhausted, or auto-collection is not @@ -1616,6 +1612,12 @@ private constructor( this.nextAttemptAt = nextAttemptAt } + /** Number of auto-collection payment attempts. */ + fun numAttempts(numAttempts: Long) = numAttempts(JsonField.of(numAttempts)) + + /** Number of auto-collection payment attempts. */ + fun numAttempts(numAttempts: JsonField) = apply { this.numAttempts = numAttempts } + /** * If Orb has ever attempted payment auto-collection for this invoice, this field will * reflect when that attempt occurred. In conjunction with `next_attempt_at`, this can @@ -1639,18 +1641,6 @@ private constructor( this.previouslyAttemptedAt = previouslyAttemptedAt } - /** True only if auto-collection is enabled for this invoice. */ - fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) - - /** True only if auto-collection is enabled for this invoice. */ - fun enabled(enabled: JsonField) = apply { this.enabled = enabled } - - /** Number of auto-collection payment attempts. */ - fun numAttempts(numAttempts: Long) = numAttempts(JsonField.of(numAttempts)) - - /** Number of auto-collection payment attempts. */ - fun numAttempts(numAttempts: JsonField) = apply { this.numAttempts = numAttempts } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1672,10 +1662,10 @@ private constructor( fun build(): AutoCollection = AutoCollection( - nextAttemptAt, - previouslyAttemptedAt, enabled, + nextAttemptAt, numAttempts, + previouslyAttemptedAt, additionalProperties.toImmutable(), ) } @@ -1685,69 +1675,69 @@ private constructor( return true } - return /* spotless:off */ other is AutoCollection && nextAttemptAt == other.nextAttemptAt && previouslyAttemptedAt == other.previouslyAttemptedAt && enabled == other.enabled && numAttempts == other.numAttempts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AutoCollection && enabled == other.enabled && nextAttemptAt == other.nextAttemptAt && numAttempts == other.numAttempts && previouslyAttemptedAt == other.previouslyAttemptedAt && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(nextAttemptAt, previouslyAttemptedAt, enabled, numAttempts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(enabled, nextAttemptAt, numAttempts, previouslyAttemptedAt, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AutoCollection{nextAttemptAt=$nextAttemptAt, previouslyAttemptedAt=$previouslyAttemptedAt, enabled=$enabled, numAttempts=$numAttempts, additionalProperties=$additionalProperties}" + "AutoCollection{enabled=$enabled, nextAttemptAt=$nextAttemptAt, numAttempts=$numAttempts, previouslyAttemptedAt=$previouslyAttemptedAt, additionalProperties=$additionalProperties}" } @NoAutoDetect class BillingAddress @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), @JsonProperty("postal_code") @ExcludeMissing private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("country") + @JsonProperty("state") @ExcludeMissing - private val country: JsonField = JsonMissing.of(), + private val state: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing @@ -1757,12 +1747,12 @@ private constructor( fun validate(): BillingAddress = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -1776,48 +1766,48 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(billingAddress: BillingAddress) = apply { + city = billingAddress.city + country = billingAddress.country line1 = billingAddress.line1 line2 = billingAddress.line2 - city = billingAddress.city - state = billingAddress.state postalCode = billingAddress.postalCode - country = billingAddress.country + state = billingAddress.state additionalProperties = billingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = line1(JsonField.of(line1)) + fun city(city: String) = city(JsonField.of(city)) - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: String) = line2(JsonField.of(line2)) + fun country(country: String) = country(JsonField.of(country)) - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: String) = city(JsonField.of(city)) + fun line1(line1: String) = line1(JsonField.of(line1)) - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: String) = state(JsonField.of(state)) + fun line2(line2: String) = line2(JsonField.of(line2)) - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: String) = country(JsonField.of(country)) + fun state(state: String) = state(JsonField.of(state)) - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1840,12 +1830,12 @@ private constructor( fun build(): BillingAddress = BillingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1855,17 +1845,17 @@ private constructor( return true } - return /* spotless:off */ other is BillingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BillingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BillingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "BillingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1876,21 +1866,21 @@ private constructor( @JsonProperty("credit_note_number") @ExcludeMissing private val creditNoteNumber: JsonField = JsonMissing.of(), + @JsonProperty("memo") + @ExcludeMissing + private val memo: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), - @JsonProperty("voided_at") - @ExcludeMissing - private val voidedAt: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("memo") + @JsonProperty("voided_at") @ExcludeMissing - private val memo: JsonField = JsonMissing.of(), + private val voidedAt: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -1899,10 +1889,15 @@ private constructor( fun creditNoteNumber(): String = creditNoteNumber.getRequired("credit_note_number") + /** An optional memo supplied on the credit note. */ + fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) + fun reason(): String = reason.getRequired("reason") fun total(): String = total.getRequired("total") + fun type(): String = type.getRequired("type") + /** * If the credit note has a status of `void`, this gives a timestamp when the credit note * was voided. @@ -1910,32 +1905,27 @@ private constructor( fun voidedAt(): Optional = Optional.ofNullable(voidedAt.getNullable("voided_at")) - fun type(): String = type.getRequired("type") - - /** An optional memo supplied on the credit note. */ - fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) - @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("credit_note_number") @ExcludeMissing fun _creditNoteNumber() = creditNoteNumber + /** An optional memo supplied on the credit note. */ + @JsonProperty("memo") @ExcludeMissing fun _memo() = memo + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonProperty("total") @ExcludeMissing fun _total() = total + @JsonProperty("type") @ExcludeMissing fun _type() = type + /** * If the credit note has a status of `void`, this gives a timestamp when the credit note * was voided. */ @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt - @JsonProperty("type") @ExcludeMissing fun _type() = type - - /** An optional memo supplied on the credit note. */ - @JsonProperty("memo") @ExcludeMissing fun _memo() = memo - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1946,11 +1936,11 @@ private constructor( if (!validated) { id() creditNoteNumber() + memo() reason() total() - voidedAt() type() - memo() + voidedAt() validated = true } } @@ -1966,22 +1956,22 @@ private constructor( private var id: JsonField = JsonMissing.of() private var creditNoteNumber: JsonField = JsonMissing.of() + private var memo: JsonField = JsonMissing.of() private var reason: JsonField = JsonMissing.of() private var total: JsonField = JsonMissing.of() - private var voidedAt: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var memo: JsonField = JsonMissing.of() + private var voidedAt: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditNote: CreditNote) = apply { id = creditNote.id creditNoteNumber = creditNote.creditNoteNumber + memo = creditNote.memo reason = creditNote.reason total = creditNote.total - voidedAt = creditNote.voidedAt type = creditNote.type - memo = creditNote.memo + voidedAt = creditNote.voidedAt additionalProperties = creditNote.additionalProperties.toMutableMap() } @@ -1996,6 +1986,12 @@ private constructor( this.creditNoteNumber = creditNoteNumber } + /** An optional memo supplied on the credit note. */ + fun memo(memo: String) = memo(JsonField.of(memo)) + + /** An optional memo supplied on the credit note. */ + fun memo(memo: JsonField) = apply { this.memo = memo } + fun reason(reason: String) = reason(JsonField.of(reason)) fun reason(reason: JsonField) = apply { this.reason = reason } @@ -2004,6 +2000,10 @@ private constructor( fun total(total: JsonField) = apply { this.total = total } + fun type(type: String) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + /** * If the credit note has a status of `void`, this gives a timestamp when the credit * note was voided. @@ -2016,16 +2016,6 @@ private constructor( */ fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt } - fun type(type: String) = type(JsonField.of(type)) - - fun type(type: JsonField) = apply { this.type = type } - - /** An optional memo supplied on the credit note. */ - fun memo(memo: String) = memo(JsonField.of(memo)) - - /** An optional memo supplied on the credit note. */ - fun memo(memo: JsonField) = apply { this.memo = memo } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2049,11 +2039,11 @@ private constructor( CreditNote( id, creditNoteNumber, + memo, reason, total, - voidedAt, type, - memo, + voidedAt, additionalProperties.toImmutable(), ) } @@ -2063,17 +2053,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditNote && id == other.id && creditNoteNumber == other.creditNoteNumber && reason == other.reason && total == other.total && voidedAt == other.voidedAt && type == other.type && memo == other.memo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditNote && id == other.id && creditNoteNumber == other.creditNoteNumber && memo == other.memo && reason == other.reason && total == other.total && type == other.type && voidedAt == other.voidedAt && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, creditNoteNumber, reason, total, voidedAt, type, memo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creditNoteNumber, memo, reason, total, type, voidedAt, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditNote{id=$id, creditNoteNumber=$creditNoteNumber, reason=$reason, total=$total, voidedAt=$voidedAt, type=$type, memo=$memo, additionalProperties=$additionalProperties}" + "CreditNote{id=$id, creditNoteNumber=$creditNoteNumber, memo=$memo, reason=$reason, total=$total, type=$type, voidedAt=$voidedAt, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2194,31 +2184,31 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") + @JsonProperty("action") @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), + private val action: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), - @JsonProperty("action") + @JsonProperty("created_at") @ExcludeMissing - private val action: JsonField = JsonMissing.of(), + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_note") + @ExcludeMissing + private val creditNote: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), + @JsonProperty("ending_balance") + @ExcludeMissing + private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("invoice") @ExcludeMissing private val invoice: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("credit_note") + @JsonProperty("starting_balance") @ExcludeMissing - private val creditNote: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -2226,14 +2216,20 @@ private constructor( /** A unique id for this transaction. */ fun id(): String = id.getRequired("id") + fun action(): Action = action.getRequired("action") + + /** The value of the amount changed in the transaction. */ + fun amount(): String = amount.getRequired("amount") + /** The creation time of this transaction. */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(): String = startingBalance.getRequired("starting_balance") + fun creditNote(): Optional = + Optional.ofNullable(creditNote.getNullable("credit_note")) + + /** An optional description provided for manual customer balance adjustments. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** * The new value of the customer's balance prior to the transaction, in the customer's @@ -2241,33 +2237,31 @@ private constructor( */ fun endingBalance(): String = endingBalance.getRequired("ending_balance") - /** The value of the amount changed in the transaction. */ - fun amount(): String = amount.getRequired("amount") - - fun action(): Action = action.getRequired("action") - - /** An optional description provided for manual customer balance adjustments. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - fun invoice(): Optional = Optional.ofNullable(invoice.getNullable("invoice")) - fun type(): Type = type.getRequired("type") + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(): String = startingBalance.getRequired("starting_balance") - fun creditNote(): Optional = - Optional.ofNullable(creditNote.getNullable("credit_note")) + fun type(): Type = type.getRequired("type") /** A unique id for this transaction. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("action") @ExcludeMissing fun _action() = action + + /** The value of the amount changed in the transaction. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** The creation time of this transaction. */ @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + + /** An optional description provided for manual customer balance adjustments. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description /** * The new value of the customer's balance prior to the transaction, in the customer's @@ -2275,19 +2269,15 @@ private constructor( */ @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - /** The value of the amount changed in the transaction. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("action") @ExcludeMissing fun _action() = action - - /** An optional description provided for manual customer balance adjustments. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("invoice") @ExcludeMissing fun _invoice() = invoice - @JsonProperty("type") @ExcludeMissing fun _type() = type + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance - @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing @@ -2298,15 +2288,15 @@ private constructor( fun validate(): CustomerBalanceTransaction = apply { if (!validated) { id() - createdAt() - startingBalance() - endingBalance() - amount() action() + amount() + createdAt() + creditNote().map { it.validate() } description() + endingBalance() invoice().map { it.validate() } + startingBalance() type() - creditNote().map { it.validate() } validated = true } } @@ -2321,29 +2311,29 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var action: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var creditNote: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() private var invoice: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var creditNote: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(customerBalanceTransaction: CustomerBalanceTransaction) = apply { id = customerBalanceTransaction.id - createdAt = customerBalanceTransaction.createdAt - startingBalance = customerBalanceTransaction.startingBalance - endingBalance = customerBalanceTransaction.endingBalance - amount = customerBalanceTransaction.amount action = customerBalanceTransaction.action + amount = customerBalanceTransaction.amount + createdAt = customerBalanceTransaction.createdAt + creditNote = customerBalanceTransaction.creditNote description = customerBalanceTransaction.description + endingBalance = customerBalanceTransaction.endingBalance invoice = customerBalanceTransaction.invoice + startingBalance = customerBalanceTransaction.startingBalance type = customerBalanceTransaction.type - creditNote = customerBalanceTransaction.creditNote additionalProperties = customerBalanceTransaction.additionalProperties.toMutableMap() } @@ -2354,6 +2344,16 @@ private constructor( /** A unique id for this transaction. */ fun id(id: JsonField) = apply { this.id = id } + fun action(action: Action) = action(JsonField.of(action)) + + fun action(action: JsonField) = apply { this.action = action } + + /** The value of the amount changed in the transaction. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The value of the amount changed in the transaction. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The creation time of this transaction. */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -2362,19 +2362,18 @@ private constructor( this.createdAt = createdAt } - /** - * The original value of the customer's balance prior to the transaction, in the - * customer's currency. - */ - fun startingBalance(startingBalance: String) = - startingBalance(JsonField.of(startingBalance)) + fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) - /** - * The original value of the customer's balance prior to the transaction, in the - * customer's currency. - */ - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun creditNote(creditNote: JsonField) = apply { + this.creditNote = creditNote + } + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: String) = description(JsonField.of(description)) + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: JsonField) = apply { + this.description = description } /** @@ -2391,38 +2390,29 @@ private constructor( this.endingBalance = endingBalance } - /** The value of the amount changed in the transaction. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The value of the amount changed in the transaction. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun action(action: Action) = action(JsonField.of(action)) + fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice)) - fun action(action: JsonField) = apply { this.action = action } + fun invoice(invoice: JsonField) = apply { this.invoice = invoice } - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: String) = description(JsonField.of(description)) + /** + * The original value of the customer's balance prior to the transaction, in the + * customer's currency. + */ + fun startingBalance(startingBalance: String) = + startingBalance(JsonField.of(startingBalance)) - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: JsonField) = apply { - this.description = description + /** + * The original value of the customer's balance prior to the transaction, in the + * customer's currency. + */ + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice)) - - fun invoice(invoice: JsonField) = apply { this.invoice = invoice } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } - fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) - - fun creditNote(creditNote: JsonField) = apply { - this.creditNote = creditNote - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2445,15 +2435,15 @@ private constructor( fun build(): CustomerBalanceTransaction = CustomerBalanceTransaction( id, - createdAt, - startingBalance, - endingBalance, - amount, action, + amount, + createdAt, + creditNote, description, + endingBalance, invoice, + startingBalance, type, - creditNote, additionalProperties.toImmutable(), ) } @@ -2806,17 +2796,17 @@ private constructor( return true } - return /* spotless:off */ other is CustomerBalanceTransaction && id == other.id && createdAt == other.createdAt && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && action == other.action && description == other.description && invoice == other.invoice && type == other.type && creditNote == other.creditNote && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransaction && id == other.id && action == other.action && amount == other.amount && createdAt == other.createdAt && creditNote == other.creditNote && description == other.description && endingBalance == other.endingBalance && invoice == other.invoice && startingBalance == other.startingBalance && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, createdAt, startingBalance, endingBalance, amount, action, description, invoice, type, creditNote, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, action, amount, createdAt, creditNote, description, endingBalance, invoice, startingBalance, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerBalanceTransaction{id=$id, createdAt=$createdAt, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, action=$action, description=$description, invoice=$invoice, type=$type, creditNote=$creditNote, additionalProperties=$additionalProperties}" + "CustomerBalanceTransaction{id=$id, action=$action, amount=$amount, createdAt=$createdAt, creditNote=$creditNote, description=$description, endingBalance=$endingBalance, invoice=$invoice, startingBalance=$startingBalance, type=$type, additionalProperties=$additionalProperties}" } /** @@ -4098,6 +4088,7 @@ private constructor( class LineItem @JsonCreator private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), @@ -4110,94 +4101,73 @@ private constructor( @JsonProperty("grouping") @ExcludeMissing private val grouping: JsonField = JsonMissing.of(), - @JsonProperty("minimum") - @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("minimum") + @ExcludeMissing + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("price") + @ExcludeMissing + private val price: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("subtotal") - @ExcludeMissing - private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("sub_line_items") @ExcludeMissing private val subLineItems: JsonField> = JsonMissing.of(), + @JsonProperty("subtotal") + @ExcludeMissing + private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("tax_amounts") @ExcludeMissing private val taxAmounts: JsonField> = JsonMissing.of(), - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("price") - @ExcludeMissing - private val price: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** A unique ID for this line item. */ + fun id(): String = id.getRequired("id") + /** The final amount after any discounts or minimums. */ fun amount(): String = amount.getRequired("amount") fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) /** The end date of the range of time applied for this line item's price. */ - fun endDate(): OffsetDateTime = endDate.getRequired("end_date") - - /** - * [DEPRECATED] For configured prices that are split by a grouping key, this will be - * populated with the key and a value. The `amount` and `subtotal` will be the values for - * this particular grouping. - */ - fun grouping(): Optional = Optional.ofNullable(grouping.getNullable("grouping")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) - - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - - /** The name of the price associated with this line item. */ - fun name(): String = name.getRequired("name") - - fun quantity(): Double = quantity.getRequired("quantity") - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(): List = subLineItems.getRequired("sub_line_items") + fun endDate(): OffsetDateTime = endDate.getRequired("end_date") /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. + * [DEPRECATED] For configured prices that are split by a grouping key, this will be + * populated with the key and a value. The `amount` and `subtotal` will be the values for + * this particular grouping. */ - fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") + fun grouping(): Optional = Optional.ofNullable(grouping.getNullable("grouping")) - /** A unique ID for this line item. */ - fun id(): String = id.getRequired("id") + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) + + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + /** The name of the price associated with this line item. */ + fun name(): String = name.getRequired("name") /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -4429,6 +4399,29 @@ private constructor( */ fun price(): Optional = Optional.ofNullable(price.getNullable("price")) + fun quantity(): Double = quantity.getRequired("quantity") + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(): List = subLineItems.getRequired("sub_line_items") + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(): String = subtotal.getRequired("subtotal") + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") + + /** A unique ID for this line item. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The final amount after any discounts or minimums. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @@ -4444,39 +4437,16 @@ private constructor( */ @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum - - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - /** The name of the price associated with this line item. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - - /** The start date of the range of time applied for this line item's price. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The line amount before any line item-specific discounts or minimums. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal - - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - @JsonProperty("sub_line_items") @ExcludeMissing fun _subLineItems() = subLineItems + @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - @JsonProperty("tax_amounts") @ExcludeMissing fun _taxAmounts() = taxAmounts + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** A unique ID for this line item. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The name of the price associated with this line item. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -4708,6 +4678,26 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + + /** The start date of the range of time applied for this line item's price. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + @JsonProperty("sub_line_items") @ExcludeMissing fun _subLineItems() = subLineItems + + /** The line amount before any line item-specific discounts or minimums. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + @JsonProperty("tax_amounts") @ExcludeMissing fun _taxAmounts() = taxAmounts + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4716,22 +4706,22 @@ private constructor( fun validate(): LineItem = apply { if (!validated) { + id() amount() discount() endDate() grouping() - minimum().map { it.validate() } - minimumAmount() maximum().map { it.validate() } maximumAmount() + minimum().map { it.validate() } + minimumAmount() name() + price() quantity() startDate() - subtotal() subLineItems() + subtotal() taxAmounts().forEach { it.validate() } - id() - price() validated = true } } @@ -4745,45 +4735,51 @@ private constructor( class Builder { + private var id: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() private var grouping: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var subtotal: JsonField = JsonMissing.of() private var subLineItems: JsonField> = JsonMissing.of() + private var subtotal: JsonField = JsonMissing.of() private var taxAmounts: JsonField> = JsonMissing.of() - private var id: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(lineItem: LineItem) = apply { + id = lineItem.id amount = lineItem.amount discount = lineItem.discount endDate = lineItem.endDate grouping = lineItem.grouping - minimum = lineItem.minimum - minimumAmount = lineItem.minimumAmount maximum = lineItem.maximum maximumAmount = lineItem.maximumAmount + minimum = lineItem.minimum + minimumAmount = lineItem.minimumAmount name = lineItem.name + price = lineItem.price quantity = lineItem.quantity startDate = lineItem.startDate - subtotal = lineItem.subtotal subLineItems = lineItem.subLineItems + subtotal = lineItem.subtotal taxAmounts = lineItem.taxAmounts - id = lineItem.id - price = lineItem.price additionalProperties = lineItem.additionalProperties.toMutableMap() } + /** A unique ID for this line item. */ + fun id(id: String) = id(JsonField.of(id)) + + /** A unique ID for this line item. */ + fun id(id: JsonField) = apply { this.id = id } + /** The final amount after any discounts or minimums. */ fun amount(amount: String) = amount(JsonField.of(amount)) @@ -4814,16 +4810,6 @@ private constructor( */ fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - - fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) fun maximum(maximum: JsonField) = apply { this.maximum = maximum } @@ -4834,64 +4820,21 @@ private constructor( this.maximumAmount = maximumAmount } - /** The name of the price associated with this line item. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price associated with this line item. */ - fun name(name: JsonField) = apply { this.name = name } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(subLineItems: List) = - subLineItems(JsonField.of(subLineItems)) + fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(subLineItems: JsonField>) = apply { - this.subLineItems = subLineItems - } + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - fun taxAmounts(taxAmounts: List) = taxAmounts(JsonField.of(taxAmounts)) + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - fun taxAmounts(taxAmounts: JsonField>) = apply { - this.taxAmounts = taxAmounts + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount } - /** A unique ID for this line item. */ - fun id(id: String) = id(JsonField.of(id)) + /** The name of the price associated with this line item. */ + fun name(name: String) = name(JsonField.of(name)) - /** A unique ID for this line item. */ - fun id(id: JsonField) = apply { this.id = id } + /** The name of the price associated with this line item. */ + fun name(name: JsonField) = apply { this.name = name } /** * The Price resource represents a price that can be billed on a subscription, resulting @@ -5353,6 +5296,53 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(subLineItems: List) = + subLineItems(JsonField.of(subLineItems)) + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(subLineItems: JsonField>) = apply { + this.subLineItems = subLineItems + } + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(taxAmounts: List) = taxAmounts(JsonField.of(taxAmounts)) + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(taxAmounts: JsonField>) = apply { + this.taxAmounts = taxAmounts + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5374,22 +5364,22 @@ private constructor( fun build(): LineItem = LineItem( + id, amount, discount, endDate, grouping, - minimum, - minimumAmount, maximum, maximumAmount, + minimum, + minimumAmount, name, + price, quantity, startDate, - subtotal, subLineItems.map { it.toImmutable() }, + subtotal, taxAmounts.map { it.toImmutable() }, - id, - price, additionalProperties.toImmutable(), ) } @@ -5398,19 +5388,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -5419,7 +5406,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -5429,6 +5416,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5437,8 +5427,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -5452,26 +5442,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -5487,6 +5468,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5511,8 +5501,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -5522,36 +5512,33 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } @NoAutoDetect class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -5560,7 +5547,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -5570,6 +5557,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5578,8 +5568,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -5593,26 +5583,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -5628,6 +5609,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5652,8 +5642,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -5663,17 +5653,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } @JsonDeserialize(using = SubLineItem.Deserializer::class) @@ -5848,21 +5838,21 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), + @JsonProperty("matrix_config") + @ExcludeMissing + private val matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") - @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("matrix_config") - @ExcludeMissing - private val matrixConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5870,30 +5860,30 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + + fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) - fun type(): Type = type.getRequired("type") - fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") - /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + + @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5903,11 +5893,11 @@ private constructor( fun validate(): MatrixSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } + matrixConfig().validate() name() quantity() - grouping().map { it.validate() } type() - matrixConfig().validate() validated = true } } @@ -5922,21 +5912,21 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() + private var matrixConfig: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var matrixConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixSubLineItem: MatrixSubLineItem) = apply { amount = matrixSubLineItem.amount + grouping = matrixSubLineItem.grouping + matrixConfig = matrixSubLineItem.matrixConfig name = matrixSubLineItem.name quantity = matrixSubLineItem.quantity - grouping = matrixSubLineItem.grouping type = matrixSubLineItem.type - matrixConfig = matrixSubLineItem.matrixConfig additionalProperties = matrixSubLineItem.additionalProperties.toMutableMap() } @@ -5946,6 +5936,17 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + + fun matrixConfig(matrixConfig: MatrixConfig) = + matrixConfig(JsonField.of(matrixConfig)) + + fun matrixConfig(matrixConfig: JsonField) = apply { + this.matrixConfig = matrixConfig + } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -5954,21 +5955,10 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } - fun matrixConfig(matrixConfig: MatrixConfig) = - matrixConfig(JsonField.of(matrixConfig)) - - fun matrixConfig(matrixConfig: JsonField) = apply { - this.matrixConfig = matrixConfig - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5994,11 +5984,11 @@ private constructor( fun build(): MatrixSubLineItem = MatrixSubLineItem( amount, + grouping, + matrixConfig, name, quantity, - grouping, type, - matrixConfig, additionalProperties.toImmutable(), ) } @@ -6285,17 +6275,17 @@ private constructor( return true } - return /* spotless:off */ other is MatrixSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && matrixConfig == other.matrixConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixSubLineItem && amount == other.amount && grouping == other.grouping && matrixConfig == other.matrixConfig && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, matrixConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, matrixConfig, name, quantity, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, matrixConfig=$matrixConfig, additionalProperties=$additionalProperties}" + "MatrixSubLineItem{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -6305,21 +6295,21 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") + @JsonProperty("tier_config") @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), + private val tierConfig: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("tier_config") - @ExcludeMissing - private val tierConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -6327,30 +6317,30 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) + fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") fun type(): Type = type.getRequired("type") - fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") - /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("tier_config") @ExcludeMissing fun _tierConfig() = tierConfig @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("tier_config") @ExcludeMissing fun _tierConfig() = tierConfig - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6360,11 +6350,11 @@ private constructor( fun validate(): TierSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } name() quantity() - grouping().map { it.validate() } - type() tierConfig().validate() + type() validated = true } } @@ -6379,21 +6369,21 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() private var tierConfig: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tierSubLineItem: TierSubLineItem) = apply { amount = tierSubLineItem.amount + grouping = tierSubLineItem.grouping name = tierSubLineItem.name quantity = tierSubLineItem.quantity - grouping = tierSubLineItem.grouping - type = tierSubLineItem.type tierConfig = tierSubLineItem.tierConfig + type = tierSubLineItem.type additionalProperties = tierSubLineItem.additionalProperties.toMutableMap() } @@ -6403,6 +6393,10 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -6411,20 +6405,16 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - - fun type(type: Type) = type(JsonField.of(type)) - - fun type(type: JsonField) = apply { this.type = type } - fun tierConfig(tierConfig: TierConfig) = tierConfig(JsonField.of(tierConfig)) fun tierConfig(tierConfig: JsonField) = apply { this.tierConfig = tierConfig } + fun type(type: Type) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6450,11 +6440,11 @@ private constructor( fun build(): TierSubLineItem = TierSubLineItem( amount, + grouping, name, quantity, - grouping, - type, tierConfig, + type, additionalProperties.toImmutable(), ) } @@ -6768,17 +6758,17 @@ private constructor( return true } - return /* spotless:off */ other is TierSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && tierConfig == other.tierConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TierSubLineItem && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && tierConfig == other.tierConfig && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, tierConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, name, quantity, tierConfig, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TierSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, tierConfig=$tierConfig, additionalProperties=$additionalProperties}" + "TierSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -6788,15 +6778,15 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") - @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @@ -6807,24 +6797,24 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) - fun type(): Type = type.getRequired("type") /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @@ -6836,9 +6826,9 @@ private constructor( fun validate(): OtherSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } name() quantity() - grouping().map { it.validate() } type() validated = true } @@ -6854,18 +6844,18 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(otherSubLineItem: OtherSubLineItem) = apply { amount = otherSubLineItem.amount + grouping = otherSubLineItem.grouping name = otherSubLineItem.name quantity = otherSubLineItem.quantity - grouping = otherSubLineItem.grouping type = otherSubLineItem.type additionalProperties = otherSubLineItem.additionalProperties.toMutableMap() } @@ -6876,6 +6866,10 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -6884,10 +6878,6 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } @@ -6917,9 +6907,9 @@ private constructor( fun build(): OtherSubLineItem = OtherSubLineItem( amount, + grouping, name, quantity, - grouping, type, additionalProperties.toImmutable(), ) @@ -7099,17 +7089,17 @@ private constructor( return true } - return /* spotless:off */ other is OtherSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is OtherSubLineItem && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, name, quantity, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "OtherSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, additionalProperties=$additionalProperties}" + "OtherSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } } @@ -7117,19 +7107,22 @@ private constructor( class TaxAmount @JsonCreator private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_description") @ExcludeMissing private val taxRateDescription: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_percentage") @ExcludeMissing private val taxRatePercentage: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The amount of additional tax incurred by this tax rate. */ + fun amount(): String = amount.getRequired("amount") + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(): String = taxRateDescription.getRequired("tax_rate_description") @@ -7139,7 +7132,7 @@ private constructor( Optional.ofNullable(taxRatePercentage.getNullable("tax_rate_percentage")) /** The amount of additional tax incurred by this tax rate. */ - fun amount(): String = amount.getRequired("amount") + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** The human-readable description of the applied tax rate. */ @JsonProperty("tax_rate_description") @@ -7148,11 +7141,8 @@ private constructor( /** The tax rate percentage, out of 100. */ @JsonProperty("tax_rate_percentage") - @ExcludeMissing - fun _taxRatePercentage() = taxRatePercentage - - /** The amount of additional tax incurred by this tax rate. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @ExcludeMissing + fun _taxRatePercentage() = taxRatePercentage @JsonAnyGetter @ExcludeMissing @@ -7162,9 +7152,9 @@ private constructor( fun validate(): TaxAmount = apply { if (!validated) { + amount() taxRateDescription() taxRatePercentage() - amount() validated = true } } @@ -7178,19 +7168,25 @@ private constructor( class Builder { + private var amount: JsonField = JsonMissing.of() private var taxRateDescription: JsonField = JsonMissing.of() private var taxRatePercentage: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(taxAmount: TaxAmount) = apply { + amount = taxAmount.amount taxRateDescription = taxAmount.taxRateDescription taxRatePercentage = taxAmount.taxRatePercentage - amount = taxAmount.amount additionalProperties = taxAmount.additionalProperties.toMutableMap() } + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(taxRateDescription: String) = taxRateDescription(JsonField.of(taxRateDescription)) @@ -7209,12 +7205,6 @@ private constructor( this.taxRatePercentage = taxRatePercentage } - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7239,9 +7229,9 @@ private constructor( fun build(): TaxAmount = TaxAmount( + amount, taxRateDescription, taxRatePercentage, - amount, additionalProperties.toImmutable(), ) } @@ -7251,17 +7241,17 @@ private constructor( return true } - return /* spotless:off */ other is TaxAmount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TaxAmount && amount == other.amount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(taxRateDescription, taxRatePercentage, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, taxRateDescription, taxRatePercentage, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TaxAmount{taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, amount=$amount, additionalProperties=$additionalProperties}" + "TaxAmount{amount=$amount, taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -7269,36 +7259,33 @@ private constructor( return true } - return /* spotless:off */ other is LineItem && amount == other.amount && discount == other.discount && endDate == other.endDate && grouping == other.grouping && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && name == other.name && quantity == other.quantity && startDate == other.startDate && subtotal == other.subtotal && subLineItems == other.subLineItems && taxAmounts == other.taxAmounts && id == other.id && price == other.price && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LineItem && id == other.id && amount == other.amount && discount == other.discount && endDate == other.endDate && grouping == other.grouping && maximum == other.maximum && maximumAmount == other.maximumAmount && minimum == other.minimum && minimumAmount == other.minimumAmount && name == other.name && price == other.price && quantity == other.quantity && startDate == other.startDate && subLineItems == other.subLineItems && subtotal == other.subtotal && taxAmounts == other.taxAmounts && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, discount, endDate, grouping, minimum, minimumAmount, maximum, maximumAmount, name, quantity, startDate, subtotal, subLineItems, taxAmounts, id, price, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, discount, endDate, grouping, maximum, maximumAmount, minimum, minimumAmount, name, price, quantity, startDate, subLineItems, subtotal, taxAmounts, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LineItem{amount=$amount, discount=$discount, endDate=$endDate, grouping=$grouping, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, name=$name, quantity=$quantity, startDate=$startDate, subtotal=$subtotal, subLineItems=$subLineItems, taxAmounts=$taxAmounts, id=$id, price=$price, additionalProperties=$additionalProperties}" + "LineItem{id=$id, amount=$amount, discount=$discount, endDate=$endDate, grouping=$grouping, maximum=$maximum, maximumAmount=$maximumAmount, minimum=$minimum, minimumAmount=$minimumAmount, name=$name, price=$price, quantity=$quantity, startDate=$startDate, subLineItems=$subLineItems, subtotal=$subtotal, taxAmounts=$taxAmounts, additionalProperties=$additionalProperties}" } @NoAutoDetect class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this * can be a subset of prices. @@ -7307,7 +7294,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this @@ -7317,6 +7304,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7325,8 +7315,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -7340,25 +7330,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -7374,6 +7356,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7395,8 +7385,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -7406,17 +7396,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -7503,19 +7493,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this * can be a subset of prices. @@ -7524,7 +7511,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this @@ -7534,6 +7521,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7542,8 +7532,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -7557,25 +7547,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -7591,6 +7573,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7612,8 +7602,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -7623,17 +7613,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -7641,21 +7631,21 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), @JsonProperty("payment_provider") @ExcludeMissing private val paymentProvider: JsonField = JsonMissing.of(), @JsonProperty("payment_provider_id") @ExcludeMissing private val paymentProviderId: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), @JsonProperty("succeeded") @ExcludeMissing private val succeeded: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -7663,6 +7653,12 @@ private constructor( /** The ID of the payment attempt. */ fun id(): String = id.getRequired("id") + /** The amount of the payment attempt. */ + fun amount(): String = amount.getRequired("amount") + + /** The time at which the payment attempt was created. */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + /** The payment provider that attempted to collect the payment. */ fun paymentProvider(): Optional = Optional.ofNullable(paymentProvider.getNullable("payment_provider")) @@ -7671,18 +7667,18 @@ private constructor( fun paymentProviderId(): Optional = Optional.ofNullable(paymentProviderId.getNullable("payment_provider_id")) - /** The amount of the payment attempt. */ - fun amount(): String = amount.getRequired("amount") - /** Whether the payment attempt succeeded. */ fun succeeded(): Boolean = succeeded.getRequired("succeeded") - /** The time at which the payment attempt was created. */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** The ID of the payment attempt. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The amount of the payment attempt. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + + /** The time at which the payment attempt was created. */ + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + /** The payment provider that attempted to collect the payment. */ @JsonProperty("payment_provider") @ExcludeMissing fun _paymentProvider() = paymentProvider @@ -7691,15 +7687,9 @@ private constructor( @ExcludeMissing fun _paymentProviderId() = paymentProviderId - /** The amount of the payment attempt. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - /** Whether the payment attempt succeeded. */ @JsonProperty("succeeded") @ExcludeMissing fun _succeeded() = succeeded - /** The time at which the payment attempt was created. */ - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7709,11 +7699,11 @@ private constructor( fun validate(): PaymentAttempt = apply { if (!validated) { id() + amount() + createdAt() paymentProvider() paymentProviderId() - amount() succeeded() - createdAt() validated = true } } @@ -7728,21 +7718,21 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var paymentProvider: JsonField = JsonMissing.of() private var paymentProviderId: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var succeeded: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(paymentAttempt: PaymentAttempt) = apply { id = paymentAttempt.id + amount = paymentAttempt.amount + createdAt = paymentAttempt.createdAt paymentProvider = paymentAttempt.paymentProvider paymentProviderId = paymentAttempt.paymentProviderId - amount = paymentAttempt.amount succeeded = paymentAttempt.succeeded - createdAt = paymentAttempt.createdAt additionalProperties = paymentAttempt.additionalProperties.toMutableMap() } @@ -7752,6 +7742,20 @@ private constructor( /** The ID of the payment attempt. */ fun id(id: JsonField) = apply { this.id = id } + /** The amount of the payment attempt. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount of the payment attempt. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** The time at which the payment attempt was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** The time at which the payment attempt was created. */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + /** The payment provider that attempted to collect the payment. */ fun paymentProvider(paymentProvider: PaymentProvider) = paymentProvider(JsonField.of(paymentProvider)) @@ -7770,26 +7774,12 @@ private constructor( this.paymentProviderId = paymentProviderId } - /** The amount of the payment attempt. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The amount of the payment attempt. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - /** Whether the payment attempt succeeded. */ fun succeeded(succeeded: Boolean) = succeeded(JsonField.of(succeeded)) /** Whether the payment attempt succeeded. */ fun succeeded(succeeded: JsonField) = apply { this.succeeded = succeeded } - /** The time at which the payment attempt was created. */ - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** The time at which the payment attempt was created. */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7812,11 +7802,11 @@ private constructor( fun build(): PaymentAttempt = PaymentAttempt( id, + amount, + createdAt, paymentProvider, paymentProviderId, - amount, succeeded, - createdAt, additionalProperties.toImmutable(), ) } @@ -7877,69 +7867,69 @@ private constructor( return true } - return /* spotless:off */ other is PaymentAttempt && id == other.id && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && amount == other.amount && succeeded == other.succeeded && createdAt == other.createdAt && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PaymentAttempt && id == other.id && amount == other.amount && createdAt == other.createdAt && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && succeeded == other.succeeded && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, paymentProvider, paymentProviderId, amount, succeeded, createdAt, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, paymentProvider, paymentProviderId, succeeded, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PaymentAttempt{id=$id, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, amount=$amount, succeeded=$succeeded, createdAt=$createdAt, additionalProperties=$additionalProperties}" + "PaymentAttempt{id=$id, amount=$amount, createdAt=$createdAt, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, succeeded=$succeeded, additionalProperties=$additionalProperties}" } @NoAutoDetect class ShippingAddress @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), @JsonProperty("postal_code") @ExcludeMissing private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("country") + @JsonProperty("state") @ExcludeMissing - private val country: JsonField = JsonMissing.of(), + private val state: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing @@ -7949,12 +7939,12 @@ private constructor( fun validate(): ShippingAddress = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -7968,48 +7958,48 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(shippingAddress: ShippingAddress) = apply { + city = shippingAddress.city + country = shippingAddress.country line1 = shippingAddress.line1 line2 = shippingAddress.line2 - city = shippingAddress.city - state = shippingAddress.state postalCode = shippingAddress.postalCode - country = shippingAddress.country + state = shippingAddress.state additionalProperties = shippingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = line1(JsonField.of(line1)) + fun city(city: String) = city(JsonField.of(city)) - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: String) = line2(JsonField.of(line2)) + fun country(country: String) = country(JsonField.of(country)) - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: String) = city(JsonField.of(city)) + fun line1(line1: String) = line1(JsonField.of(line1)) - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: String) = state(JsonField.of(state)) + fun line2(line2: String) = line2(JsonField.of(line2)) - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: String) = country(JsonField.of(country)) + fun state(state: String) = state(JsonField.of(state)) - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8032,12 +8022,12 @@ private constructor( fun build(): ShippingAddress = ShippingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -8047,17 +8037,17 @@ private constructor( return true } - return /* spotless:off */ other is ShippingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ShippingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ShippingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } class Status @@ -8227,15 +8217,15 @@ private constructor( return true } - return /* spotless:off */ other is Invoice && metadata == other.metadata && voidedAt == other.voidedAt && paidAt == other.paidAt && issuedAt == other.issuedAt && scheduledIssueAt == other.scheduledIssueAt && autoCollection == other.autoCollection && issueFailedAt == other.issueFailedAt && syncFailedAt == other.syncFailedAt && paymentFailedAt == other.paymentFailedAt && paymentStartedAt == other.paymentStartedAt && amountDue == other.amountDue && createdAt == other.createdAt && currency == other.currency && customer == other.customer && discount == other.discount && discounts == other.discounts && dueDate == other.dueDate && id == other.id && invoicePdf == other.invoicePdf && invoiceNumber == other.invoiceNumber && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && lineItems == other.lineItems && subscription == other.subscription && subtotal == other.subtotal && total == other.total && customerBalanceTransactions == other.customerBalanceTransactions && status == other.status && invoiceSource == other.invoiceSource && shippingAddress == other.shippingAddress && billingAddress == other.billingAddress && hostedInvoiceUrl == other.hostedInvoiceUrl && willAutoIssue == other.willAutoIssue && eligibleToIssueAt == other.eligibleToIssueAt && customerTaxId == other.customerTaxId && memo == other.memo && creditNotes == other.creditNotes && paymentAttempts == other.paymentAttempts && invoiceDate == other.invoiceDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Invoice && id == other.id && amountDue == other.amountDue && autoCollection == other.autoCollection && billingAddress == other.billingAddress && createdAt == other.createdAt && creditNotes == other.creditNotes && currency == other.currency && customer == other.customer && customerBalanceTransactions == other.customerBalanceTransactions && customerTaxId == other.customerTaxId && discount == other.discount && discounts == other.discounts && dueDate == other.dueDate && eligibleToIssueAt == other.eligibleToIssueAt && hostedInvoiceUrl == other.hostedInvoiceUrl && invoiceDate == other.invoiceDate && invoiceNumber == other.invoiceNumber && invoicePdf == other.invoicePdf && invoiceSource == other.invoiceSource && issueFailedAt == other.issueFailedAt && issuedAt == other.issuedAt && lineItems == other.lineItems && maximum == other.maximum && maximumAmount == other.maximumAmount && memo == other.memo && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && paidAt == other.paidAt && paymentAttempts == other.paymentAttempts && paymentFailedAt == other.paymentFailedAt && paymentStartedAt == other.paymentStartedAt && scheduledIssueAt == other.scheduledIssueAt && shippingAddress == other.shippingAddress && status == other.status && subscription == other.subscription && subtotal == other.subtotal && syncFailedAt == other.syncFailedAt && total == other.total && voidedAt == other.voidedAt && willAutoIssue == other.willAutoIssue && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, voidedAt, paidAt, issuedAt, scheduledIssueAt, autoCollection, issueFailedAt, syncFailedAt, paymentFailedAt, paymentStartedAt, amountDue, createdAt, currency, customer, discount, discounts, dueDate, id, invoicePdf, invoiceNumber, minimum, minimumAmount, maximum, maximumAmount, lineItems, subscription, subtotal, total, customerBalanceTransactions, status, invoiceSource, shippingAddress, billingAddress, hostedInvoiceUrl, willAutoIssue, eligibleToIssueAt, customerTaxId, memo, creditNotes, paymentAttempts, invoiceDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amountDue, autoCollection, billingAddress, createdAt, creditNotes, currency, customer, customerBalanceTransactions, customerTaxId, discount, discounts, dueDate, eligibleToIssueAt, hostedInvoiceUrl, invoiceDate, invoiceNumber, invoicePdf, invoiceSource, issueFailedAt, issuedAt, lineItems, maximum, maximumAmount, memo, metadata, minimum, minimumAmount, paidAt, paymentAttempts, paymentFailedAt, paymentStartedAt, scheduledIssueAt, shippingAddress, status, subscription, subtotal, syncFailedAt, total, voidedAt, willAutoIssue, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Invoice{metadata=$metadata, voidedAt=$voidedAt, paidAt=$paidAt, issuedAt=$issuedAt, scheduledIssueAt=$scheduledIssueAt, autoCollection=$autoCollection, issueFailedAt=$issueFailedAt, syncFailedAt=$syncFailedAt, paymentFailedAt=$paymentFailedAt, paymentStartedAt=$paymentStartedAt, amountDue=$amountDue, createdAt=$createdAt, currency=$currency, customer=$customer, discount=$discount, discounts=$discounts, dueDate=$dueDate, id=$id, invoicePdf=$invoicePdf, invoiceNumber=$invoiceNumber, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, lineItems=$lineItems, subscription=$subscription, subtotal=$subtotal, total=$total, customerBalanceTransactions=$customerBalanceTransactions, status=$status, invoiceSource=$invoiceSource, shippingAddress=$shippingAddress, billingAddress=$billingAddress, hostedInvoiceUrl=$hostedInvoiceUrl, willAutoIssue=$willAutoIssue, eligibleToIssueAt=$eligibleToIssueAt, customerTaxId=$customerTaxId, memo=$memo, creditNotes=$creditNotes, paymentAttempts=$paymentAttempts, invoiceDate=$invoiceDate, additionalProperties=$additionalProperties}" + "Invoice{id=$id, amountDue=$amountDue, autoCollection=$autoCollection, billingAddress=$billingAddress, createdAt=$createdAt, creditNotes=$creditNotes, currency=$currency, customer=$customer, customerBalanceTransactions=$customerBalanceTransactions, customerTaxId=$customerTaxId, discount=$discount, discounts=$discounts, dueDate=$dueDate, eligibleToIssueAt=$eligibleToIssueAt, hostedInvoiceUrl=$hostedInvoiceUrl, invoiceDate=$invoiceDate, invoiceNumber=$invoiceNumber, invoicePdf=$invoicePdf, invoiceSource=$invoiceSource, issueFailedAt=$issueFailedAt, issuedAt=$issuedAt, lineItems=$lineItems, maximum=$maximum, maximumAmount=$maximumAmount, memo=$memo, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, paidAt=$paidAt, paymentAttempts=$paymentAttempts, paymentFailedAt=$paymentFailedAt, paymentStartedAt=$paymentStartedAt, scheduledIssueAt=$scheduledIssueAt, shippingAddress=$shippingAddress, status=$status, subscription=$subscription, subtotal=$subtotal, syncFailedAt=$syncFailedAt, total=$total, voidedAt=$voidedAt, willAutoIssue=$willAutoIssue, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt index afc2b4e0..bd815815 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt @@ -233,10 +233,19 @@ constructor( * The id of the `Customer` to create this invoice for. One of `customer_id` and * `external_customer_id` are required. */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** + * The id of the `Customer` to create this invoice for. One of `customer_id` and + * `external_customer_id` are required. + */ + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) + + /** An optional discount to attach to the invoice. */ + fun discount(discount: Discount?) = apply { this.discount = discount } /** An optional discount to attach to the invoice. */ - fun discount(discount: Discount) = apply { this.discount = discount } + fun discount(discount: Optional) = discount(discount.orElse(null)) fun discount(percentageDiscount: PercentageDiscount) = apply { this.discount = Discount.ofPercentageDiscount(percentageDiscount) @@ -258,25 +267,58 @@ constructor( * The `external_customer_id` of the `Customer` to create this invoice for. One of * `customer_id` and `external_customer_id` are required. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** + * The `external_customer_id` of the `Customer` to create this invoice for. One of + * `customer_id` and `external_customer_id` are required. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + /** An optional memo to attach to the invoice. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String?) = apply { this.memo = memo } + + /** An optional memo to attach to the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** + * When true, this invoice will automatically be issued upon creation. When false, the + * resulting invoice will require manual review to issue. Defaulted to false. + */ + fun willAutoIssue(willAutoIssue: Boolean?) = apply { + this.willAutoIssue = willAutoIssue + } /** * When true, this invoice will automatically be issued upon creation. When false, the * resulting invoice will require manual review to issue. Defaulted to false. */ - fun willAutoIssue(willAutoIssue: Boolean) = apply { this.willAutoIssue = willAutoIssue } + fun willAutoIssue(willAutoIssue: Boolean) = willAutoIssue(willAutoIssue as Boolean?) + + /** + * When true, this invoice will automatically be issued upon creation. When false, the + * resulting invoice will require manual review to issue. Defaulted to false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun willAutoIssue(willAutoIssue: Optional) = + willAutoIssue(willAutoIssue.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -379,10 +421,19 @@ constructor( * The id of the `Customer` to create this invoice for. One of `customer_id` and * `external_customer_id` are required. */ - fun customerId(customerId: String) = apply { body.customerId(customerId) } + fun customerId(customerId: String?) = apply { body.customerId(customerId) } + + /** + * The id of the `Customer` to create this invoice for. One of `customer_id` and + * `external_customer_id` are required. + */ + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** An optional discount to attach to the invoice. */ - fun discount(discount: Discount) = apply { body.discount(discount) } + fun discount(discount: Discount?) = apply { body.discount(discount) } + + /** An optional discount to attach to the invoice. */ + fun discount(discount: Optional) = discount(discount.orElse(null)) fun discount(percentageDiscount: PercentageDiscount) = apply { body.discount(percentageDiscount) @@ -398,25 +449,56 @@ constructor( * The `external_customer_id` of the `Customer` to create this invoice for. One of * `customer_id` and `external_customer_id` are required. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } + /** + * The `external_customer_id` of the `Customer` to create this invoice for. One of + * `customer_id` and `external_customer_id` are required. + */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + /** An optional memo to attach to the invoice. */ - fun memo(memo: String) = apply { body.memo(memo) } + fun memo(memo: String?) = apply { body.memo(memo) } + + /** An optional memo to attach to the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) /** * When true, this invoice will automatically be issued upon creation. When false, the * resulting invoice will require manual review to issue. Defaulted to false. */ - fun willAutoIssue(willAutoIssue: Boolean) = apply { body.willAutoIssue(willAutoIssue) } + fun willAutoIssue(willAutoIssue: Boolean?) = apply { body.willAutoIssue(willAutoIssue) } + + /** + * When true, this invoice will automatically be issued upon creation. When false, the + * resulting invoice will require manual review to issue. Defaulted to false. + */ + fun willAutoIssue(willAutoIssue: Boolean) = willAutoIssue(willAutoIssue as Boolean?) + + /** + * When true, this invoice will automatically be issued upon creation. When false, the + * resulting invoice will require manual review to issue. Defaulted to false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun willAutoIssue(willAutoIssue: Optional) = + willAutoIssue(willAutoIssue.orElse(null) as Boolean?) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -547,32 +629,32 @@ constructor( class LineItem @JsonCreator private constructor( - @JsonProperty("start_date") private val startDate: LocalDate, @JsonProperty("end_date") private val endDate: LocalDate, - @JsonProperty("quantity") private val quantity: Double, - @JsonProperty("name") private val name: String, @JsonProperty("item_id") private val itemId: String, @JsonProperty("model_type") private val modelType: ModelType, + @JsonProperty("name") private val name: String, + @JsonProperty("quantity") private val quantity: Double, + @JsonProperty("start_date") private val startDate: LocalDate, @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A date string to specify the line item's start date in the customer's timezone. */ - @JsonProperty("start_date") fun startDate(): LocalDate = startDate - /** A date string to specify the line item's end date in the customer's timezone. */ @JsonProperty("end_date") fun endDate(): LocalDate = endDate - /** The number of units on the line item */ - @JsonProperty("quantity") fun quantity(): Double = quantity + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the line item. */ @JsonProperty("name") fun name(): String = name - @JsonProperty("item_id") fun itemId(): String = itemId + /** The number of units on the line item */ + @JsonProperty("quantity") fun quantity(): Double = quantity - @JsonProperty("model_type") fun modelType(): ModelType = modelType + /** A date string to specify the line item's start date in the customer's timezone. */ + @JsonProperty("start_date") fun startDate(): LocalDate = startDate @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig @@ -589,42 +671,42 @@ constructor( class Builder { - private var startDate: LocalDate? = null private var endDate: LocalDate? = null - private var quantity: Double? = null - private var name: String? = null private var itemId: String? = null private var modelType: ModelType? = null + private var name: String? = null + private var quantity: Double? = null + private var startDate: LocalDate? = null private var unitConfig: UnitConfig? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(lineItem: LineItem) = apply { - startDate = lineItem.startDate endDate = lineItem.endDate - quantity = lineItem.quantity - name = lineItem.name itemId = lineItem.itemId modelType = lineItem.modelType + name = lineItem.name + quantity = lineItem.quantity + startDate = lineItem.startDate unitConfig = lineItem.unitConfig additionalProperties = lineItem.additionalProperties.toMutableMap() } - /** A date string to specify the line item's start date in the customer's timezone. */ - fun startDate(startDate: LocalDate) = apply { this.startDate = startDate } - /** A date string to specify the line item's end date in the customer's timezone. */ fun endDate(endDate: LocalDate) = apply { this.endDate = endDate } - /** The number of units on the line item */ - fun quantity(quantity: Double) = apply { this.quantity = quantity } + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the line item. */ fun name(name: String) = apply { this.name = name } - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** The number of units on the line item */ + fun quantity(quantity: Double) = apply { this.quantity = quantity } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** A date string to specify the line item's start date in the customer's timezone. */ + fun startDate(startDate: LocalDate) = apply { this.startDate = startDate } fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } @@ -649,12 +731,12 @@ constructor( fun build(): LineItem = LineItem( - checkNotNull(startDate) { "`startDate` is required but was not set" }, checkNotNull(endDate) { "`endDate` is required but was not set" }, - checkNotNull(quantity) { "`quantity` is required but was not set" }, - checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(quantity) { "`quantity` is required but was not set" }, + checkNotNull(startDate) { "`startDate` is required but was not set" }, checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, additionalProperties.toImmutable(), ) @@ -800,17 +882,17 @@ constructor( return true } - return /* spotless:off */ other is LineItem && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && name == other.name && itemId == other.itemId && modelType == other.modelType && unitConfig == other.unitConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LineItem && endDate == other.endDate && itemId == other.itemId && modelType == other.modelType && name == other.name && quantity == other.quantity && startDate == other.startDate && unitConfig == other.unitConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, quantity, name, itemId, modelType, unitConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, itemId, modelType, name, quantity, startDate, unitConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LineItem{startDate=$startDate, endDate=$endDate, quantity=$quantity, name=$name, itemId=$itemId, modelType=$modelType, unitConfig=$unitConfig, additionalProperties=$additionalProperties}" + "LineItem{endDate=$endDate, itemId=$itemId, modelType=$modelType, name=$name, quantity=$quantity, startDate=$startDate, unitConfig=$unitConfig, additionalProperties=$additionalProperties}" } /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt index 83801157..18f19f9d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt @@ -34,48 +34,35 @@ import kotlin.jvm.optionals.getOrNull class InvoiceFetchUpcomingResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonProperty("voided_at") - @ExcludeMissing - private val voidedAt: JsonField = JsonMissing.of(), - @JsonProperty("paid_at") - @ExcludeMissing - private val paidAt: JsonField = JsonMissing.of(), - @JsonProperty("issued_at") - @ExcludeMissing - private val issuedAt: JsonField = JsonMissing.of(), - @JsonProperty("scheduled_issue_at") + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount_due") @ExcludeMissing - private val scheduledIssueAt: JsonField = JsonMissing.of(), + private val amountDue: JsonField = JsonMissing.of(), @JsonProperty("auto_collection") @ExcludeMissing private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("issue_failed_at") - @ExcludeMissing - private val issueFailedAt: JsonField = JsonMissing.of(), - @JsonProperty("sync_failed_at") - @ExcludeMissing - private val syncFailedAt: JsonField = JsonMissing.of(), - @JsonProperty("payment_failed_at") - @ExcludeMissing - private val paymentFailedAt: JsonField = JsonMissing.of(), - @JsonProperty("payment_started_at") - @ExcludeMissing - private val paymentStartedAt: JsonField = JsonMissing.of(), - @JsonProperty("amount_due") + @JsonProperty("billing_address") @ExcludeMissing - private val amountDue: JsonField = JsonMissing.of(), + private val billingAddress: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_notes") + @ExcludeMissing + private val creditNotes: JsonField> = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @JsonProperty("customer") @ExcludeMissing private val customer: JsonField = JsonMissing.of(), + @JsonProperty("customer_balance_transactions") + @ExcludeMissing + private val customerBalanceTransactions: JsonField> = + JsonMissing.of(), + @JsonProperty("customer_tax_id") + @ExcludeMissing + private val customerTaxId: JsonField = JsonMissing.of(), @JsonProperty("discount") @ExcludeMissing private val discount: JsonValue = JsonMissing.of(), @JsonProperty("discounts") @ExcludeMissing @@ -83,136 +70,90 @@ private constructor( @JsonProperty("due_date") @ExcludeMissing private val dueDate: JsonField = JsonMissing.of(), - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("invoice_pdf") + @JsonProperty("eligible_to_issue_at") @ExcludeMissing - private val invoicePdf: JsonField = JsonMissing.of(), + private val eligibleToIssueAt: JsonField = JsonMissing.of(), + @JsonProperty("hosted_invoice_url") + @ExcludeMissing + private val hostedInvoiceUrl: JsonField = JsonMissing.of(), @JsonProperty("invoice_number") @ExcludeMissing private val invoiceNumber: JsonField = JsonMissing.of(), - @JsonProperty("minimum") + @JsonProperty("invoice_pdf") @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") + private val invoicePdf: JsonField = JsonMissing.of(), + @JsonProperty("invoice_source") @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), + private val invoiceSource: JsonField = JsonMissing.of(), + @JsonProperty("issue_failed_at") + @ExcludeMissing + private val issueFailedAt: JsonField = JsonMissing.of(), + @JsonProperty("issued_at") + @ExcludeMissing + private val issuedAt: JsonField = JsonMissing.of(), + @JsonProperty("line_items") + @ExcludeMissing + private val lineItems: JsonField> = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("line_items") - @ExcludeMissing - private val lineItems: JsonField> = JsonMissing.of(), - @JsonProperty("subscription") + @JsonProperty("memo") @ExcludeMissing private val memo: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val subscription: JsonField = JsonMissing.of(), - @JsonProperty("subtotal") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum") @ExcludeMissing - private val subtotal: JsonField = JsonMissing.of(), - @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), - @JsonProperty("customer_balance_transactions") + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") @ExcludeMissing - private val customerBalanceTransactions: JsonField> = - JsonMissing.of(), - @JsonProperty("status") + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("paid_at") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("invoice_source") + private val paidAt: JsonField = JsonMissing.of(), + @JsonProperty("payment_attempts") @ExcludeMissing - private val invoiceSource: JsonField = JsonMissing.of(), - @JsonProperty("shipping_address") + private val paymentAttempts: JsonField> = JsonMissing.of(), + @JsonProperty("payment_failed_at") @ExcludeMissing - private val shippingAddress: JsonField = JsonMissing.of(), - @JsonProperty("billing_address") + private val paymentFailedAt: JsonField = JsonMissing.of(), + @JsonProperty("payment_started_at") @ExcludeMissing - private val billingAddress: JsonField = JsonMissing.of(), - @JsonProperty("hosted_invoice_url") + private val paymentStartedAt: JsonField = JsonMissing.of(), + @JsonProperty("scheduled_issue_at") @ExcludeMissing - private val hostedInvoiceUrl: JsonField = JsonMissing.of(), - @JsonProperty("will_auto_issue") + private val scheduledIssueAt: JsonField = JsonMissing.of(), + @JsonProperty("shipping_address") @ExcludeMissing - private val willAutoIssue: JsonField = JsonMissing.of(), - @JsonProperty("eligible_to_issue_at") + private val shippingAddress: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val eligibleToIssueAt: JsonField = JsonMissing.of(), - @JsonProperty("customer_tax_id") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("subscription") @ExcludeMissing - private val customerTaxId: JsonField = JsonMissing.of(), - @JsonProperty("memo") @ExcludeMissing private val memo: JsonField = JsonMissing.of(), - @JsonProperty("credit_notes") + private val subscription: JsonField = JsonMissing.of(), + @JsonProperty("subtotal") @ExcludeMissing - private val creditNotes: JsonField> = JsonMissing.of(), - @JsonProperty("payment_attempts") + private val subtotal: JsonField = JsonMissing.of(), + @JsonProperty("sync_failed_at") @ExcludeMissing - private val paymentAttempts: JsonField> = JsonMissing.of(), + private val syncFailedAt: JsonField = JsonMissing.of(), @JsonProperty("target_date") @ExcludeMissing private val targetDate: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), + @JsonProperty("voided_at") + @ExcludeMissing + private val voidedAt: JsonField = JsonMissing.of(), + @JsonProperty("will_auto_issue") + @ExcludeMissing + private val willAutoIssue: 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") - - /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. - */ - fun voidedAt(): Optional = - Optional.ofNullable(voidedAt.getNullable("voided_at")) - - /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ - fun paidAt(): Optional = Optional.ofNullable(paidAt.getNullable("paid_at")) - - /** - * If the invoice has been issued, this will be the time it transitioned to `issued` (even if it - * is now in a different state.) - */ - fun issuedAt(): Optional = - Optional.ofNullable(issuedAt.getNullable("issued_at")) - - /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be - * issued. - */ - fun scheduledIssueAt(): Optional = - Optional.ofNullable(scheduledIssueAt.getNullable("scheduled_issue_at")) - - fun autoCollection(): AutoCollection = autoCollection.getRequired("auto_collection") - - /** - * If the invoice failed to issue, this will be the last time it failed to issue (even if it is - * now in a different state.) - */ - fun issueFailedAt(): Optional = - Optional.ofNullable(issueFailedAt.getNullable("issue_failed_at")) - - /** - * If the invoice failed to sync, this will be the last time an external invoicing provider sync - * was attempted. This field will always be `null` for invoices using Orb Invoicing. - */ - fun syncFailedAt(): Optional = - Optional.ofNullable(syncFailedAt.getNullable("sync_failed_at")) - - /** - * If payment was attempted on this invoice but failed, this will be the time of the most recent - * attempt. - */ - fun paymentFailedAt(): Optional = - Optional.ofNullable(paymentFailedAt.getNullable("payment_failed_at")) - - /** - * If payment was attempted on this invoice, this will be the start time of the most recent - * attempt. This field is especially useful for delayed-notification payment mechanisms (like - * bank transfers), where payment can take 3 days or more. - */ - fun paymentStartedAt(): Optional = - Optional.ofNullable(paymentStartedAt.getNullable("payment_started_at")) + fun id(): String = id.getRequired("id") /** * This is the final amount required to be charged to the customer and reflects the application @@ -220,87 +161,25 @@ private constructor( */ fun amountDue(): String = amountDue.getRequired("amount_due") + fun autoCollection(): AutoCollection = autoCollection.getRequired("auto_collection") + + fun billingAddress(): Optional = + Optional.ofNullable(billingAddress.getNullable("billing_address")) + /** The creation time of the resource in Orb. */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + /** A list of credit notes associated with the invoice */ + fun creditNotes(): List = creditNotes.getRequired("credit_notes") + /** An ISO 4217 currency string or `credits` */ fun currency(): String = currency.getRequired("currency") fun customer(): Customer = customer.getRequired("customer") - fun discounts(): List = discounts.getRequired("discounts") - - /** - * When the invoice payment is due. The due date is null if the invoice is not yet finalized. - */ - fun dueDate(): Optional = Optional.ofNullable(dueDate.getNullable("due_date")) - - fun id(): String = id.getRequired("id") - - /** The link to download the PDF representation of the `Invoice`. */ - fun invoicePdf(): Optional = Optional.ofNullable(invoicePdf.getNullable("invoice_pdf")) - - /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers - * have a prefix such as `RFOBWG`. These can be sequential per account or customer. - */ - fun invoiceNumber(): String = invoiceNumber.getRequired("invoice_number") - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) - - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - - /** The breakdown of prices in this invoice. */ - fun lineItems(): List = lineItems.getRequired("line_items") - - fun subscription(): Optional = - Optional.ofNullable(subscription.getNullable("subscription")) - - /** The total before any discounts and minimums are applied. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** The total after any minimums and discounts have been applied. */ - fun total(): String = total.getRequired("total") - fun customerBalanceTransactions(): List = customerBalanceTransactions.getRequired("customer_balance_transactions") - fun status(): Status = status.getRequired("status") - - fun invoiceSource(): InvoiceSource = invoiceSource.getRequired("invoice_source") - - fun shippingAddress(): Optional = - Optional.ofNullable(shippingAddress.getNullable("shipping_address")) - - fun billingAddress(): Optional = - Optional.ofNullable(billingAddress.getNullable("billing_address")) - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's - * due date, or 60 days after being re-generated through the UI. - */ - fun hostedInvoiceUrl(): Optional = - Optional.ofNullable(hostedInvoiceUrl.getNullable("hosted_invoice_url")) - - /** - * This is true if the invoice will be automatically issued in the future, and false otherwise. - */ - fun willAutoIssue(): Boolean = willAutoIssue.getRequired("will_auto_issue") - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will - * automatically begin issuing at this time. - */ - fun eligibleToIssueAt(): Optional = - Optional.ofNullable(eligibleToIssueAt.getNullable("eligible_to_issue_at")) - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to the * headers of invoices. @@ -410,161 +289,164 @@ private constructor( fun customerTaxId(): Optional = Optional.ofNullable(customerTaxId.getNullable("customer_tax_id")) - /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ - fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) - - /** A list of credit notes associated with the invoice */ - fun creditNotes(): List = creditNotes.getRequired("credit_notes") - - /** A list of payment attempts associated with the invoice */ - fun paymentAttempts(): List = paymentAttempts.getRequired("payment_attempts") + fun discounts(): List = discounts.getRequired("discounts") - /** The scheduled date of the invoice */ - fun targetDate(): OffsetDateTime = targetDate.getRequired("target_date") + /** When the invoice payment is due. */ + fun dueDate(): OffsetDateTime = dueDate.getRequired("due_date") /** - * 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`. + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will + * automatically begin issuing at this time. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + fun eligibleToIssueAt(): Optional = + Optional.ofNullable(eligibleToIssueAt.getNullable("eligible_to_issue_at")) /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. + * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's + * due date, or 60 days after being re-generated through the UI. */ - @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt - - /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ - @JsonProperty("paid_at") @ExcludeMissing fun _paidAt() = paidAt + fun hostedInvoiceUrl(): Optional = + Optional.ofNullable(hostedInvoiceUrl.getNullable("hosted_invoice_url")) /** - * If the invoice has been issued, this will be the time it transitioned to `issued` (even if it - * is now in a different state.) + * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers + * have a prefix such as `RFOBWG`. These can be sequential per account or customer. */ - @JsonProperty("issued_at") @ExcludeMissing fun _issuedAt() = issuedAt + fun invoiceNumber(): String = invoiceNumber.getRequired("invoice_number") - /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be - * issued. - */ - @JsonProperty("scheduled_issue_at") @ExcludeMissing fun _scheduledIssueAt() = scheduledIssueAt + /** The link to download the PDF representation of the `Invoice`. */ + fun invoicePdf(): Optional = Optional.ofNullable(invoicePdf.getNullable("invoice_pdf")) - @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + fun invoiceSource(): InvoiceSource = invoiceSource.getRequired("invoice_source") /** * If the invoice failed to issue, this will be the last time it failed to issue (even if it is * now in a different state.) */ - @JsonProperty("issue_failed_at") @ExcludeMissing fun _issueFailedAt() = issueFailedAt + fun issueFailedAt(): Optional = + Optional.ofNullable(issueFailedAt.getNullable("issue_failed_at")) /** - * If the invoice failed to sync, this will be the last time an external invoicing provider sync - * was attempted. This field will always be `null` for invoices using Orb Invoicing. + * If the invoice has been issued, this will be the time it transitioned to `issued` (even if it + * is now in a different state.) */ - @JsonProperty("sync_failed_at") @ExcludeMissing fun _syncFailedAt() = syncFailedAt + fun issuedAt(): Optional = + Optional.ofNullable(issuedAt.getNullable("issued_at")) + + /** The breakdown of prices in this invoice. */ + fun lineItems(): List = lineItems.getRequired("line_items") + + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) + + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ + fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) + + /** + * 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 minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ + fun paidAt(): Optional = Optional.ofNullable(paidAt.getNullable("paid_at")) + + /** A list of payment attempts associated with the invoice */ + fun paymentAttempts(): List = paymentAttempts.getRequired("payment_attempts") /** * If payment was attempted on this invoice but failed, this will be the time of the most recent * attempt. */ - @JsonProperty("payment_failed_at") @ExcludeMissing fun _paymentFailedAt() = paymentFailedAt + fun paymentFailedAt(): Optional = + Optional.ofNullable(paymentFailedAt.getNullable("payment_failed_at")) /** * If payment was attempted on this invoice, this will be the start time of the most recent * attempt. This field is especially useful for delayed-notification payment mechanisms (like * bank transfers), where payment can take 3 days or more. */ - @JsonProperty("payment_started_at") @ExcludeMissing fun _paymentStartedAt() = paymentStartedAt + fun paymentStartedAt(): Optional = + Optional.ofNullable(paymentStartedAt.getNullable("payment_started_at")) /** - * This is the final amount required to be charged to the customer and reflects the application - * of the customer balance to the `total` of the invoice. + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be + * issued. */ - @JsonProperty("amount_due") @ExcludeMissing fun _amountDue() = amountDue + fun scheduledIssueAt(): Optional = + Optional.ofNullable(scheduledIssueAt.getNullable("scheduled_issue_at")) - /** The creation time of the resource in Orb. */ - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun shippingAddress(): Optional = + Optional.ofNullable(shippingAddress.getNullable("shipping_address")) - /** An ISO 4217 currency string or `credits` */ - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun status(): Status = status.getRequired("status") - @JsonProperty("customer") @ExcludeMissing fun _customer() = customer + fun subscription(): Optional = + Optional.ofNullable(subscription.getNullable("subscription")) + + /** The total before any discounts and minimums are applied. */ + fun subtotal(): String = subtotal.getRequired("subtotal") /** - * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the - * first discount in the list will be returned. If the list is empty, `None` will be returned. + * If the invoice failed to sync, this will be the last time an external invoicing provider sync + * was attempted. This field will always be `null` for invoices using Orb Invoicing. */ - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + fun syncFailedAt(): Optional = + Optional.ofNullable(syncFailedAt.getNullable("sync_failed_at")) - @JsonProperty("discounts") @ExcludeMissing fun _discounts() = discounts + /** The scheduled date of the invoice */ + fun targetDate(): OffsetDateTime = targetDate.getRequired("target_date") + + /** The total after any minimums and discounts have been applied. */ + fun total(): String = total.getRequired("total") /** - * When the invoice payment is due. The due date is null if the invoice is not yet finalized. + * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. */ - @JsonProperty("due_date") @ExcludeMissing fun _dueDate() = dueDate - - @JsonProperty("id") @ExcludeMissing fun _id() = id - - /** The link to download the PDF representation of the `Invoice`. */ - @JsonProperty("invoice_pdf") @ExcludeMissing fun _invoicePdf() = invoicePdf + fun voidedAt(): Optional = + Optional.ofNullable(voidedAt.getNullable("voided_at")) /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers - * have a prefix such as `RFOBWG`. These can be sequential per account or customer. + * This is true if the invoice will be automatically issued in the future, and false otherwise. */ - @JsonProperty("invoice_number") @ExcludeMissing fun _invoiceNumber() = invoiceNumber + fun willAutoIssue(): Boolean = willAutoIssue.getRequired("will_auto_issue") - @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** + * This is the final amount required to be charged to the customer and reflects the application + * of the customer balance to the `total` of the invoice. + */ + @JsonProperty("amount_due") @ExcludeMissing fun _amountDue() = amountDue - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("billing_address") @ExcludeMissing fun _billingAddress() = billingAddress - /** The breakdown of prices in this invoice. */ - @JsonProperty("line_items") @ExcludeMissing fun _lineItems() = lineItems + /** The creation time of the resource in Orb. */ + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("subscription") @ExcludeMissing fun _subscription() = subscription + /** A list of credit notes associated with the invoice */ + @JsonProperty("credit_notes") @ExcludeMissing fun _creditNotes() = creditNotes - /** The total before any discounts and minimums are applied. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + /** An ISO 4217 currency string or `credits` */ + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - /** The total after any minimums and discounts have been applied. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + @JsonProperty("customer") @ExcludeMissing fun _customer() = customer @JsonProperty("customer_balance_transactions") @ExcludeMissing fun _customerBalanceTransactions() = customerBalanceTransactions - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("invoice_source") @ExcludeMissing fun _invoiceSource() = invoiceSource - - @JsonProperty("shipping_address") @ExcludeMissing fun _shippingAddress() = shippingAddress - - @JsonProperty("billing_address") @ExcludeMissing fun _billingAddress() = billingAddress - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's - * due date, or 60 days after being re-generated through the UI. - */ - @JsonProperty("hosted_invoice_url") @ExcludeMissing fun _hostedInvoiceUrl() = hostedInvoiceUrl - - /** - * This is true if the invoice will be automatically issued in the future, and false otherwise. - */ - @JsonProperty("will_auto_issue") @ExcludeMissing fun _willAutoIssue() = willAutoIssue - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will - * automatically begin issuing at this time. - */ - @JsonProperty("eligible_to_issue_at") - @ExcludeMissing - fun _eligibleToIssueAt() = eligibleToIssueAt - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to the * headers of invoices. @@ -673,66 +555,180 @@ private constructor( */ @JsonProperty("customer_tax_id") @ExcludeMissing fun _customerTaxId() = customerTaxId - /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ - @JsonProperty("memo") @ExcludeMissing fun _memo() = memo - - /** A list of credit notes associated with the invoice */ - @JsonProperty("credit_notes") @ExcludeMissing fun _creditNotes() = creditNotes + /** + * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the + * first discount in the list will be returned. If the list is empty, `None` will be returned. + */ + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount - /** A list of payment attempts associated with the invoice */ - @JsonProperty("payment_attempts") @ExcludeMissing fun _paymentAttempts() = paymentAttempts + @JsonProperty("discounts") @ExcludeMissing fun _discounts() = discounts - /** The scheduled date of the invoice */ - @JsonProperty("target_date") @ExcludeMissing fun _targetDate() = targetDate + /** When the invoice payment is due. */ + @JsonProperty("due_date") @ExcludeMissing fun _dueDate() = dueDate - @JsonAnyGetter + /** + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice will + * automatically begin issuing at this time. + */ + @JsonProperty("eligible_to_issue_at") @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _eligibleToIssueAt() = eligibleToIssueAt - private var validated: Boolean = false + /** + * A URL for the customer-facing invoice portal. This URL expires 30 days after the invoice's + * due date, or 60 days after being re-generated through the UI. + */ + @JsonProperty("hosted_invoice_url") @ExcludeMissing fun _hostedInvoiceUrl() = hostedInvoiceUrl - fun validate(): InvoiceFetchUpcomingResponse = apply { - if (!validated) { - metadata().validate() - voidedAt() - paidAt() - issuedAt() - scheduledIssueAt() - autoCollection().validate() - issueFailedAt() - syncFailedAt() - paymentFailedAt() - paymentStartedAt() - amountDue() - createdAt() - currency() - customer().validate() - discounts() - dueDate() - id() - invoicePdf() + /** + * Automatically generated invoice number to help track and reconcile invoices. Invoice numbers + * have a prefix such as `RFOBWG`. These can be sequential per account or customer. + */ + @JsonProperty("invoice_number") @ExcludeMissing fun _invoiceNumber() = invoiceNumber + + /** The link to download the PDF representation of the `Invoice`. */ + @JsonProperty("invoice_pdf") @ExcludeMissing fun _invoicePdf() = invoicePdf + + @JsonProperty("invoice_source") @ExcludeMissing fun _invoiceSource() = invoiceSource + + /** + * If the invoice failed to issue, this will be the last time it failed to issue (even if it is + * now in a different state.) + */ + @JsonProperty("issue_failed_at") @ExcludeMissing fun _issueFailedAt() = issueFailedAt + + /** + * If the invoice has been issued, this will be the time it transitioned to `issued` (even if it + * is now in a different state.) + */ + @JsonProperty("issued_at") @ExcludeMissing fun _issuedAt() = issuedAt + + /** The breakdown of prices in this invoice. */ + @JsonProperty("line_items") @ExcludeMissing fun _lineItems() = lineItems + + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ + @JsonProperty("memo") @ExcludeMissing fun _memo() = memo + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum + + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + + /** If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. */ + @JsonProperty("paid_at") @ExcludeMissing fun _paidAt() = paidAt + + /** A list of payment attempts associated with the invoice */ + @JsonProperty("payment_attempts") @ExcludeMissing fun _paymentAttempts() = paymentAttempts + + /** + * If payment was attempted on this invoice but failed, this will be the time of the most recent + * attempt. + */ + @JsonProperty("payment_failed_at") @ExcludeMissing fun _paymentFailedAt() = paymentFailedAt + + /** + * If payment was attempted on this invoice, this will be the start time of the most recent + * attempt. This field is especially useful for delayed-notification payment mechanisms (like + * bank transfers), where payment can take 3 days or more. + */ + @JsonProperty("payment_started_at") @ExcludeMissing fun _paymentStartedAt() = paymentStartedAt + + /** + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to be + * issued. + */ + @JsonProperty("scheduled_issue_at") @ExcludeMissing fun _scheduledIssueAt() = scheduledIssueAt + + @JsonProperty("shipping_address") @ExcludeMissing fun _shippingAddress() = shippingAddress + + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("subscription") @ExcludeMissing fun _subscription() = subscription + + /** The total before any discounts and minimums are applied. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** + * If the invoice failed to sync, this will be the last time an external invoicing provider sync + * was attempted. This field will always be `null` for invoices using Orb Invoicing. + */ + @JsonProperty("sync_failed_at") @ExcludeMissing fun _syncFailedAt() = syncFailedAt + + /** The scheduled date of the invoice */ + @JsonProperty("target_date") @ExcludeMissing fun _targetDate() = targetDate + + /** The total after any minimums and discounts have been applied. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total + + /** + * If the invoice has a status of `void`, this gives a timestamp when the invoice was voided. + */ + @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt + + /** + * This is true if the invoice will be automatically issued in the future, and false otherwise. + */ + @JsonProperty("will_auto_issue") @ExcludeMissing fun _willAutoIssue() = willAutoIssue + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoiceFetchUpcomingResponse = apply { + if (!validated) { + id() + amountDue() + autoCollection().validate() + billingAddress().map { it.validate() } + createdAt() + creditNotes().forEach { it.validate() } + currency() + customer().validate() + customerBalanceTransactions().forEach { it.validate() } + customerTaxId().map { it.validate() } + discounts() + dueDate() + eligibleToIssueAt() + hostedInvoiceUrl() invoiceNumber() - minimum().map { it.validate() } - minimumAmount() + invoicePdf() + invoiceSource() + issueFailedAt() + issuedAt() + lineItems().forEach { it.validate() } maximum().map { it.validate() } maximumAmount() - lineItems().forEach { it.validate() } + memo() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + paidAt() + paymentAttempts().forEach { it.validate() } + paymentFailedAt() + paymentStartedAt() + scheduledIssueAt() + shippingAddress().map { it.validate() } + status() subscription().map { it.validate() } subtotal() + syncFailedAt() + targetDate() total() - customerBalanceTransactions().forEach { it.validate() } - status() - invoiceSource() - shippingAddress().map { it.validate() } - billingAddress().map { it.validate() } - hostedInvoiceUrl() + voidedAt() willAutoIssue() - eligibleToIssueAt() - customerTaxId().map { it.validate() } - memo() - creditNotes().forEach { it.validate() } - paymentAttempts().forEach { it.validate() } - targetDate() validated = true } } @@ -746,226 +742,99 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() - private var voidedAt: JsonField = JsonMissing.of() - private var paidAt: JsonField = JsonMissing.of() - private var issuedAt: JsonField = JsonMissing.of() - private var scheduledIssueAt: JsonField = JsonMissing.of() - private var autoCollection: JsonField = JsonMissing.of() - private var issueFailedAt: JsonField = JsonMissing.of() - private var syncFailedAt: JsonField = JsonMissing.of() - private var paymentFailedAt: JsonField = JsonMissing.of() - private var paymentStartedAt: JsonField = JsonMissing.of() + private var id: JsonField = JsonMissing.of() private var amountDue: JsonField = JsonMissing.of() + private var autoCollection: JsonField = JsonMissing.of() + private var billingAddress: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() + private var creditNotes: JsonField> = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var customer: JsonField = JsonMissing.of() + private var customerBalanceTransactions: JsonField> = + JsonMissing.of() + private var customerTaxId: JsonField = JsonMissing.of() private var discount: JsonValue = JsonMissing.of() private var discounts: JsonField> = JsonMissing.of() private var dueDate: JsonField = JsonMissing.of() - private var id: JsonField = JsonMissing.of() - private var invoicePdf: JsonField = JsonMissing.of() + private var eligibleToIssueAt: JsonField = JsonMissing.of() + private var hostedInvoiceUrl: JsonField = JsonMissing.of() private var invoiceNumber: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var invoicePdf: JsonField = JsonMissing.of() + private var invoiceSource: JsonField = JsonMissing.of() + private var issueFailedAt: JsonField = JsonMissing.of() + private var issuedAt: JsonField = JsonMissing.of() + private var lineItems: JsonField> = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var lineItems: JsonField> = JsonMissing.of() + private var memo: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var paidAt: JsonField = JsonMissing.of() + private var paymentAttempts: JsonField> = JsonMissing.of() + private var paymentFailedAt: JsonField = JsonMissing.of() + private var paymentStartedAt: JsonField = JsonMissing.of() + private var scheduledIssueAt: JsonField = JsonMissing.of() + private var shippingAddress: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() private var subscription: JsonField = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() + private var syncFailedAt: JsonField = JsonMissing.of() + private var targetDate: JsonField = JsonMissing.of() private var total: JsonField = JsonMissing.of() - private var customerBalanceTransactions: JsonField> = - JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var invoiceSource: JsonField = JsonMissing.of() - private var shippingAddress: JsonField = JsonMissing.of() - private var billingAddress: JsonField = JsonMissing.of() - private var hostedInvoiceUrl: JsonField = JsonMissing.of() + private var voidedAt: JsonField = JsonMissing.of() private var willAutoIssue: JsonField = JsonMissing.of() - private var eligibleToIssueAt: JsonField = JsonMissing.of() - private var customerTaxId: JsonField = JsonMissing.of() - private var memo: JsonField = JsonMissing.of() - private var creditNotes: JsonField> = JsonMissing.of() - private var paymentAttempts: JsonField> = JsonMissing.of() - private var targetDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceFetchUpcomingResponse: InvoiceFetchUpcomingResponse) = apply { - metadata = invoiceFetchUpcomingResponse.metadata - voidedAt = invoiceFetchUpcomingResponse.voidedAt - paidAt = invoiceFetchUpcomingResponse.paidAt - issuedAt = invoiceFetchUpcomingResponse.issuedAt - scheduledIssueAt = invoiceFetchUpcomingResponse.scheduledIssueAt - autoCollection = invoiceFetchUpcomingResponse.autoCollection - issueFailedAt = invoiceFetchUpcomingResponse.issueFailedAt - syncFailedAt = invoiceFetchUpcomingResponse.syncFailedAt - paymentFailedAt = invoiceFetchUpcomingResponse.paymentFailedAt - paymentStartedAt = invoiceFetchUpcomingResponse.paymentStartedAt + id = invoiceFetchUpcomingResponse.id amountDue = invoiceFetchUpcomingResponse.amountDue + autoCollection = invoiceFetchUpcomingResponse.autoCollection + billingAddress = invoiceFetchUpcomingResponse.billingAddress createdAt = invoiceFetchUpcomingResponse.createdAt + creditNotes = invoiceFetchUpcomingResponse.creditNotes currency = invoiceFetchUpcomingResponse.currency customer = invoiceFetchUpcomingResponse.customer + customerBalanceTransactions = invoiceFetchUpcomingResponse.customerBalanceTransactions + customerTaxId = invoiceFetchUpcomingResponse.customerTaxId discount = invoiceFetchUpcomingResponse.discount discounts = invoiceFetchUpcomingResponse.discounts dueDate = invoiceFetchUpcomingResponse.dueDate - id = invoiceFetchUpcomingResponse.id - invoicePdf = invoiceFetchUpcomingResponse.invoicePdf + eligibleToIssueAt = invoiceFetchUpcomingResponse.eligibleToIssueAt + hostedInvoiceUrl = invoiceFetchUpcomingResponse.hostedInvoiceUrl invoiceNumber = invoiceFetchUpcomingResponse.invoiceNumber - minimum = invoiceFetchUpcomingResponse.minimum - minimumAmount = invoiceFetchUpcomingResponse.minimumAmount + invoicePdf = invoiceFetchUpcomingResponse.invoicePdf + invoiceSource = invoiceFetchUpcomingResponse.invoiceSource + issueFailedAt = invoiceFetchUpcomingResponse.issueFailedAt + issuedAt = invoiceFetchUpcomingResponse.issuedAt + lineItems = invoiceFetchUpcomingResponse.lineItems maximum = invoiceFetchUpcomingResponse.maximum maximumAmount = invoiceFetchUpcomingResponse.maximumAmount - lineItems = invoiceFetchUpcomingResponse.lineItems - subscription = invoiceFetchUpcomingResponse.subscription - subtotal = invoiceFetchUpcomingResponse.subtotal - total = invoiceFetchUpcomingResponse.total - customerBalanceTransactions = invoiceFetchUpcomingResponse.customerBalanceTransactions - status = invoiceFetchUpcomingResponse.status - invoiceSource = invoiceFetchUpcomingResponse.invoiceSource - shippingAddress = invoiceFetchUpcomingResponse.shippingAddress - billingAddress = invoiceFetchUpcomingResponse.billingAddress - hostedInvoiceUrl = invoiceFetchUpcomingResponse.hostedInvoiceUrl - willAutoIssue = invoiceFetchUpcomingResponse.willAutoIssue - eligibleToIssueAt = invoiceFetchUpcomingResponse.eligibleToIssueAt - customerTaxId = invoiceFetchUpcomingResponse.customerTaxId memo = invoiceFetchUpcomingResponse.memo - creditNotes = invoiceFetchUpcomingResponse.creditNotes - paymentAttempts = invoiceFetchUpcomingResponse.paymentAttempts - targetDate = invoiceFetchUpcomingResponse.targetDate - additionalProperties = invoiceFetchUpcomingResponse.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 } - - /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was - * voided. - */ - fun voidedAt(voidedAt: OffsetDateTime) = voidedAt(JsonField.of(voidedAt)) - - /** - * If the invoice has a status of `void`, this gives a timestamp when the invoice was - * voided. - */ - fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt } - - /** - * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. - */ - fun paidAt(paidAt: OffsetDateTime) = paidAt(JsonField.of(paidAt)) - - /** - * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. - */ - fun paidAt(paidAt: JsonField) = apply { this.paidAt = paidAt } - - /** - * If the invoice has been issued, this will be the time it transitioned to `issued` (even - * if it is now in a different state.) - */ - fun issuedAt(issuedAt: OffsetDateTime) = issuedAt(JsonField.of(issuedAt)) - - /** - * If the invoice has been issued, this will be the time it transitioned to `issued` (even - * if it is now in a different state.) - */ - fun issuedAt(issuedAt: JsonField) = apply { this.issuedAt = issuedAt } - - /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to - * be issued. - */ - fun scheduledIssueAt(scheduledIssueAt: OffsetDateTime) = - scheduledIssueAt(JsonField.of(scheduledIssueAt)) - - /** - * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to - * be issued. - */ - fun scheduledIssueAt(scheduledIssueAt: JsonField) = apply { - this.scheduledIssueAt = scheduledIssueAt - } - - fun autoCollection(autoCollection: AutoCollection) = - autoCollection(JsonField.of(autoCollection)) - - fun autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection - } - - /** - * If the invoice failed to issue, this will be the last time it failed to issue (even if it - * is now in a different state.) - */ - fun issueFailedAt(issueFailedAt: OffsetDateTime) = - issueFailedAt(JsonField.of(issueFailedAt)) - - /** - * If the invoice failed to issue, this will be the last time it failed to issue (even if it - * is now in a different state.) - */ - fun issueFailedAt(issueFailedAt: JsonField) = apply { - this.issueFailedAt = issueFailedAt - } - - /** - * If the invoice failed to sync, this will be the last time an external invoicing provider - * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. - */ - fun syncFailedAt(syncFailedAt: OffsetDateTime) = syncFailedAt(JsonField.of(syncFailedAt)) - - /** - * If the invoice failed to sync, this will be the last time an external invoicing provider - * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. - */ - fun syncFailedAt(syncFailedAt: JsonField) = apply { - this.syncFailedAt = syncFailedAt - } - - /** - * If payment was attempted on this invoice but failed, this will be the time of the most - * recent attempt. - */ - fun paymentFailedAt(paymentFailedAt: OffsetDateTime) = - paymentFailedAt(JsonField.of(paymentFailedAt)) - - /** - * If payment was attempted on this invoice but failed, this will be the time of the most - * recent attempt. - */ - fun paymentFailedAt(paymentFailedAt: JsonField) = apply { - this.paymentFailedAt = paymentFailedAt + metadata = invoiceFetchUpcomingResponse.metadata + minimum = invoiceFetchUpcomingResponse.minimum + minimumAmount = invoiceFetchUpcomingResponse.minimumAmount + paidAt = invoiceFetchUpcomingResponse.paidAt + paymentAttempts = invoiceFetchUpcomingResponse.paymentAttempts + paymentFailedAt = invoiceFetchUpcomingResponse.paymentFailedAt + paymentStartedAt = invoiceFetchUpcomingResponse.paymentStartedAt + scheduledIssueAt = invoiceFetchUpcomingResponse.scheduledIssueAt + shippingAddress = invoiceFetchUpcomingResponse.shippingAddress + status = invoiceFetchUpcomingResponse.status + subscription = invoiceFetchUpcomingResponse.subscription + subtotal = invoiceFetchUpcomingResponse.subtotal + syncFailedAt = invoiceFetchUpcomingResponse.syncFailedAt + targetDate = invoiceFetchUpcomingResponse.targetDate + total = invoiceFetchUpcomingResponse.total + voidedAt = invoiceFetchUpcomingResponse.voidedAt + willAutoIssue = invoiceFetchUpcomingResponse.willAutoIssue + additionalProperties = invoiceFetchUpcomingResponse.additionalProperties.toMutableMap() } - /** - * If payment was attempted on this invoice, this will be the start time of the most recent - * attempt. This field is especially useful for delayed-notification payment mechanisms - * (like bank transfers), where payment can take 3 days or more. - */ - fun paymentStartedAt(paymentStartedAt: OffsetDateTime) = - paymentStartedAt(JsonField.of(paymentStartedAt)) + fun id(id: String) = id(JsonField.of(id)) - /** - * If payment was attempted on this invoice, this will be the start time of the most recent - * attempt. This field is especially useful for delayed-notification payment mechanisms - * (like bank transfers), where payment can take 3 days or more. - */ - fun paymentStartedAt(paymentStartedAt: JsonField) = apply { - this.paymentStartedAt = paymentStartedAt - } + fun id(id: JsonField) = apply { this.id = id } /** * This is the final amount required to be charged to the customer and reflects the @@ -979,12 +848,34 @@ private constructor( */ fun amountDue(amountDue: JsonField) = apply { this.amountDue = amountDue } + fun autoCollection(autoCollection: AutoCollection) = + autoCollection(JsonField.of(autoCollection)) + + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } + + fun billingAddress(billingAddress: BillingAddress) = + billingAddress(JsonField.of(billingAddress)) + + fun billingAddress(billingAddress: JsonField) = apply { + this.billingAddress = billingAddress + } + /** 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 } + /** A list of credit notes associated with the invoice */ + fun creditNotes(creditNotes: List) = creditNotes(JsonField.of(creditNotes)) + + /** A list of credit notes associated with the invoice */ + fun creditNotes(creditNotes: JsonField>) = apply { + this.creditNotes = creditNotes + } + /** An ISO 4217 currency string or `credits` */ fun currency(currency: String) = currency(JsonField.of(currency)) @@ -995,99 +886,6 @@ private constructor( fun customer(customer: JsonField) = apply { this.customer = customer } - /** - * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the - * first discount in the list will be returned. If the list is empty, `None` will be - * returned. - */ - fun discount(discount: JsonValue) = apply { this.discount = discount } - - fun discounts(discounts: List) = discounts(JsonField.of(discounts)) - - fun discounts(discounts: JsonField>) = apply { - this.discounts = discounts - } - - /** - * When the invoice payment is due. The due date is null if the invoice is not yet - * finalized. - */ - fun dueDate(dueDate: OffsetDateTime) = dueDate(JsonField.of(dueDate)) - - /** - * When the invoice payment is due. The due date is null if the invoice is not yet - * finalized. - */ - fun dueDate(dueDate: JsonField) = apply { this.dueDate = dueDate } - - fun id(id: String) = id(JsonField.of(id)) - - fun id(id: JsonField) = apply { this.id = id } - - /** The link to download the PDF representation of the `Invoice`. */ - fun invoicePdf(invoicePdf: String) = invoicePdf(JsonField.of(invoicePdf)) - - /** The link to download the PDF representation of the `Invoice`. */ - fun invoicePdf(invoicePdf: JsonField) = apply { this.invoicePdf = invoicePdf } - - /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice - * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. - */ - fun invoiceNumber(invoiceNumber: String) = invoiceNumber(JsonField.of(invoiceNumber)) - - /** - * Automatically generated invoice number to help track and reconcile invoices. Invoice - * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. - */ - fun invoiceNumber(invoiceNumber: JsonField) = apply { - this.invoiceNumber = invoiceNumber - } - - fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - - fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } - - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - - /** The breakdown of prices in this invoice. */ - fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) - - /** The breakdown of prices in this invoice. */ - fun lineItems(lineItems: JsonField>) = apply { this.lineItems = lineItems } - - fun subscription(subscription: Subscription) = subscription(JsonField.of(subscription)) - - fun subscription(subscription: JsonField) = apply { - this.subscription = subscription - } - - /** The total before any discounts and minimums are applied. */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** The total before any discounts and minimums are applied. */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** The total after any minimums and discounts have been applied. */ - fun total(total: String) = total(JsonField.of(total)) - - /** The total after any minimums and discounts have been applied. */ - fun total(total: JsonField) = apply { this.total = total } - fun customerBalanceTransactions( customerBalanceTransactions: List ) = customerBalanceTransactions(JsonField.of(customerBalanceTransactions)) @@ -1096,76 +894,6 @@ private constructor( customerBalanceTransactions: JsonField> ) = apply { this.customerBalanceTransactions = customerBalanceTransactions } - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } - - fun invoiceSource(invoiceSource: InvoiceSource) = invoiceSource(JsonField.of(invoiceSource)) - - fun invoiceSource(invoiceSource: JsonField) = apply { - this.invoiceSource = invoiceSource - } - - fun shippingAddress(shippingAddress: ShippingAddress) = - shippingAddress(JsonField.of(shippingAddress)) - - fun shippingAddress(shippingAddress: JsonField) = apply { - this.shippingAddress = shippingAddress - } - - fun billingAddress(billingAddress: BillingAddress) = - billingAddress(JsonField.of(billingAddress)) - - fun billingAddress(billingAddress: JsonField) = apply { - this.billingAddress = billingAddress - } - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the - * invoice's due date, or 60 days after being re-generated through the UI. - */ - fun hostedInvoiceUrl(hostedInvoiceUrl: String) = - hostedInvoiceUrl(JsonField.of(hostedInvoiceUrl)) - - /** - * A URL for the customer-facing invoice portal. This URL expires 30 days after the - * invoice's due date, or 60 days after being re-generated through the UI. - */ - fun hostedInvoiceUrl(hostedInvoiceUrl: JsonField) = apply { - this.hostedInvoiceUrl = hostedInvoiceUrl - } - - /** - * This is true if the invoice will be automatically issued in the future, and false - * otherwise. - */ - fun willAutoIssue(willAutoIssue: Boolean) = willAutoIssue(JsonField.of(willAutoIssue)) - - /** - * This is true if the invoice will be automatically issued in the future, and false - * otherwise. - */ - fun willAutoIssue(willAutoIssue: JsonField) = apply { - this.willAutoIssue = willAutoIssue - } - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice - * will automatically begin issuing at this time. - */ - fun eligibleToIssueAt(eligibleToIssueAt: OffsetDateTime) = - eligibleToIssueAt(JsonField.of(eligibleToIssueAt)) - - /** - * If the invoice has a status of `draft`, this will be the time that the invoice will be - * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice - * will automatically begin issuing at this time. - */ - fun eligibleToIssueAt(eligibleToIssueAt: JsonField) = apply { - this.eligibleToIssueAt = eligibleToIssueAt - } - /** * Tax IDs are commonly required to be displayed on customer invoices, which are added to * the headers of invoices. @@ -1380,8 +1108,128 @@ private constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun customerTaxId(customerTaxId: JsonField) = apply { - this.customerTaxId = customerTaxId + fun customerTaxId(customerTaxId: JsonField) = apply { + this.customerTaxId = customerTaxId + } + + /** + * This field is deprecated in favor of `discounts`. If a `discounts` list is provided, the + * first discount in the list will be returned. If the list is empty, `None` will be + * returned. + */ + fun discount(discount: JsonValue) = apply { this.discount = discount } + + fun discounts(discounts: List) = discounts(JsonField.of(discounts)) + + fun discounts(discounts: JsonField>) = apply { + this.discounts = discounts + } + + /** When the invoice payment is due. */ + fun dueDate(dueDate: OffsetDateTime) = dueDate(JsonField.of(dueDate)) + + /** When the invoice payment is due. */ + fun dueDate(dueDate: JsonField) = apply { this.dueDate = dueDate } + + /** + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice + * will automatically begin issuing at this time. + */ + fun eligibleToIssueAt(eligibleToIssueAt: OffsetDateTime) = + eligibleToIssueAt(JsonField.of(eligibleToIssueAt)) + + /** + * If the invoice has a status of `draft`, this will be the time that the invoice will be + * eligible to be issued, otherwise it will be `null`. If `auto-issue` is true, the invoice + * will automatically begin issuing at this time. + */ + fun eligibleToIssueAt(eligibleToIssueAt: JsonField) = apply { + this.eligibleToIssueAt = eligibleToIssueAt + } + + /** + * A URL for the customer-facing invoice portal. This URL expires 30 days after the + * invoice's due date, or 60 days after being re-generated through the UI. + */ + fun hostedInvoiceUrl(hostedInvoiceUrl: String) = + hostedInvoiceUrl(JsonField.of(hostedInvoiceUrl)) + + /** + * A URL for the customer-facing invoice portal. This URL expires 30 days after the + * invoice's due date, or 60 days after being re-generated through the UI. + */ + fun hostedInvoiceUrl(hostedInvoiceUrl: JsonField) = apply { + this.hostedInvoiceUrl = hostedInvoiceUrl + } + + /** + * Automatically generated invoice number to help track and reconcile invoices. Invoice + * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. + */ + fun invoiceNumber(invoiceNumber: String) = invoiceNumber(JsonField.of(invoiceNumber)) + + /** + * Automatically generated invoice number to help track and reconcile invoices. Invoice + * numbers have a prefix such as `RFOBWG`. These can be sequential per account or customer. + */ + fun invoiceNumber(invoiceNumber: JsonField) = apply { + this.invoiceNumber = invoiceNumber + } + + /** The link to download the PDF representation of the `Invoice`. */ + fun invoicePdf(invoicePdf: String) = invoicePdf(JsonField.of(invoicePdf)) + + /** The link to download the PDF representation of the `Invoice`. */ + fun invoicePdf(invoicePdf: JsonField) = apply { this.invoicePdf = invoicePdf } + + fun invoiceSource(invoiceSource: InvoiceSource) = invoiceSource(JsonField.of(invoiceSource)) + + fun invoiceSource(invoiceSource: JsonField) = apply { + this.invoiceSource = invoiceSource + } + + /** + * If the invoice failed to issue, this will be the last time it failed to issue (even if it + * is now in a different state.) + */ + fun issueFailedAt(issueFailedAt: OffsetDateTime) = + issueFailedAt(JsonField.of(issueFailedAt)) + + /** + * If the invoice failed to issue, this will be the last time it failed to issue (even if it + * is now in a different state.) + */ + fun issueFailedAt(issueFailedAt: JsonField) = apply { + this.issueFailedAt = issueFailedAt + } + + /** + * If the invoice has been issued, this will be the time it transitioned to `issued` (even + * if it is now in a different state.) + */ + fun issuedAt(issuedAt: OffsetDateTime) = issuedAt(JsonField.of(issuedAt)) + + /** + * If the invoice has been issued, this will be the time it transitioned to `issued` (even + * if it is now in a different state.) + */ + fun issuedAt(issuedAt: JsonField) = apply { this.issuedAt = issuedAt } + + /** The breakdown of prices in this invoice. */ + fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) + + /** The breakdown of prices in this invoice. */ + fun lineItems(lineItems: JsonField>) = apply { this.lineItems = lineItems } + + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ @@ -1390,14 +1238,40 @@ private constructor( /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun memo(memo: JsonField) = apply { this.memo = memo } - /** A list of credit notes associated with the invoice */ - fun creditNotes(creditNotes: List) = creditNotes(JsonField.of(creditNotes)) + /** + * 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)) - /** A list of credit notes associated with the invoice */ - fun creditNotes(creditNotes: JsonField>) = apply { - this.creditNotes = creditNotes + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) + + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } + + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount } + /** + * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. + */ + fun paidAt(paidAt: OffsetDateTime) = paidAt(JsonField.of(paidAt)) + + /** + * If the invoice has a status of `paid`, this gives a timestamp when the invoice was paid. + */ + fun paidAt(paidAt: JsonField) = apply { this.paidAt = paidAt } + /** A list of payment attempts associated with the invoice */ fun paymentAttempts(paymentAttempts: List) = paymentAttempts(JsonField.of(paymentAttempts)) @@ -1407,6 +1281,90 @@ private constructor( this.paymentAttempts = paymentAttempts } + /** + * If payment was attempted on this invoice but failed, this will be the time of the most + * recent attempt. + */ + fun paymentFailedAt(paymentFailedAt: OffsetDateTime) = + paymentFailedAt(JsonField.of(paymentFailedAt)) + + /** + * If payment was attempted on this invoice but failed, this will be the time of the most + * recent attempt. + */ + fun paymentFailedAt(paymentFailedAt: JsonField) = apply { + this.paymentFailedAt = paymentFailedAt + } + + /** + * If payment was attempted on this invoice, this will be the start time of the most recent + * attempt. This field is especially useful for delayed-notification payment mechanisms + * (like bank transfers), where payment can take 3 days or more. + */ + fun paymentStartedAt(paymentStartedAt: OffsetDateTime) = + paymentStartedAt(JsonField.of(paymentStartedAt)) + + /** + * If payment was attempted on this invoice, this will be the start time of the most recent + * attempt. This field is especially useful for delayed-notification payment mechanisms + * (like bank transfers), where payment can take 3 days or more. + */ + fun paymentStartedAt(paymentStartedAt: JsonField) = apply { + this.paymentStartedAt = paymentStartedAt + } + + /** + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to + * be issued. + */ + fun scheduledIssueAt(scheduledIssueAt: OffsetDateTime) = + scheduledIssueAt(JsonField.of(scheduledIssueAt)) + + /** + * If the invoice is in draft, this timestamp will reflect when the invoice is scheduled to + * be issued. + */ + fun scheduledIssueAt(scheduledIssueAt: JsonField) = apply { + this.scheduledIssueAt = scheduledIssueAt + } + + fun shippingAddress(shippingAddress: ShippingAddress) = + shippingAddress(JsonField.of(shippingAddress)) + + fun shippingAddress(shippingAddress: JsonField) = apply { + this.shippingAddress = shippingAddress + } + + fun status(status: Status) = status(JsonField.of(status)) + + fun status(status: JsonField) = apply { this.status = status } + + fun subscription(subscription: Subscription) = subscription(JsonField.of(subscription)) + + fun subscription(subscription: JsonField) = apply { + this.subscription = subscription + } + + /** The total before any discounts and minimums are applied. */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** The total before any discounts and minimums are applied. */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** + * If the invoice failed to sync, this will be the last time an external invoicing provider + * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. + */ + fun syncFailedAt(syncFailedAt: OffsetDateTime) = syncFailedAt(JsonField.of(syncFailedAt)) + + /** + * If the invoice failed to sync, this will be the last time an external invoicing provider + * sync was attempted. This field will always be `null` for invoices using Orb Invoicing. + */ + fun syncFailedAt(syncFailedAt: JsonField) = apply { + this.syncFailedAt = syncFailedAt + } + /** The scheduled date of the invoice */ fun targetDate(targetDate: OffsetDateTime) = targetDate(JsonField.of(targetDate)) @@ -1415,6 +1373,38 @@ private constructor( this.targetDate = targetDate } + /** The total after any minimums and discounts have been applied. */ + fun total(total: String) = total(JsonField.of(total)) + + /** The total after any minimums and discounts have been applied. */ + fun total(total: JsonField) = apply { this.total = total } + + /** + * If the invoice has a status of `void`, this gives a timestamp when the invoice was + * voided. + */ + fun voidedAt(voidedAt: OffsetDateTime) = voidedAt(JsonField.of(voidedAt)) + + /** + * If the invoice has a status of `void`, this gives a timestamp when the invoice was + * voided. + */ + fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt } + + /** + * This is true if the invoice will be automatically issued in the future, and false + * otherwise. + */ + fun willAutoIssue(willAutoIssue: Boolean) = willAutoIssue(JsonField.of(willAutoIssue)) + + /** + * This is true if the invoice will be automatically issued in the future, and false + * otherwise. + */ + fun willAutoIssue(willAutoIssue: JsonField) = apply { + this.willAutoIssue = willAutoIssue + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1436,47 +1426,47 @@ private constructor( fun build(): InvoiceFetchUpcomingResponse = InvoiceFetchUpcomingResponse( - metadata, - voidedAt, - paidAt, - issuedAt, - scheduledIssueAt, - autoCollection, - issueFailedAt, - syncFailedAt, - paymentFailedAt, - paymentStartedAt, + id, amountDue, + autoCollection, + billingAddress, createdAt, + creditNotes.map { it.toImmutable() }, currency, customer, + customerBalanceTransactions.map { it.toImmutable() }, + customerTaxId, discount, discounts.map { it.toImmutable() }, dueDate, - id, - invoicePdf, + eligibleToIssueAt, + hostedInvoiceUrl, invoiceNumber, - minimum, - minimumAmount, + invoicePdf, + invoiceSource, + issueFailedAt, + issuedAt, + lineItems.map { it.toImmutable() }, maximum, maximumAmount, - lineItems.map { it.toImmutable() }, + memo, + metadata, + minimum, + minimumAmount, + paidAt, + paymentAttempts.map { it.toImmutable() }, + paymentFailedAt, + paymentStartedAt, + scheduledIssueAt, + shippingAddress, + status, subscription, subtotal, + syncFailedAt, + targetDate, total, - customerBalanceTransactions.map { it.toImmutable() }, - status, - invoiceSource, - shippingAddress, - billingAddress, - hostedInvoiceUrl, + voidedAt, willAutoIssue, - eligibleToIssueAt, - customerTaxId, - memo, - creditNotes.map { it.toImmutable() }, - paymentAttempts.map { it.toImmutable() }, - targetDate, additionalProperties.toImmutable(), ) } @@ -1485,22 +1475,25 @@ private constructor( class AutoCollection @JsonCreator private constructor( - @JsonProperty("next_attempt_at") - @ExcludeMissing - private val nextAttemptAt: JsonField = JsonMissing.of(), - @JsonProperty("previously_attempted_at") - @ExcludeMissing - private val previouslyAttemptedAt: JsonField = JsonMissing.of(), @JsonProperty("enabled") @ExcludeMissing private val enabled: JsonField = JsonMissing.of(), + @JsonProperty("next_attempt_at") + @ExcludeMissing + private val nextAttemptAt: JsonField = JsonMissing.of(), @JsonProperty("num_attempts") @ExcludeMissing private val numAttempts: JsonField = JsonMissing.of(), + @JsonProperty("previously_attempted_at") + @ExcludeMissing + private val previouslyAttemptedAt: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** True only if auto-collection is enabled for this invoice. */ + fun enabled(): Optional = Optional.ofNullable(enabled.getNullable("enabled")) + /** * If the invoice is scheduled for auto-collection, this field will reflect when the next * attempt will occur. If dunning has been exhausted, or auto-collection is not enabled for @@ -1509,6 +1502,10 @@ private constructor( fun nextAttemptAt(): Optional = Optional.ofNullable(nextAttemptAt.getNullable("next_attempt_at")) + /** Number of auto-collection payment attempts. */ + fun numAttempts(): Optional = + Optional.ofNullable(numAttempts.getNullable("num_attempts")) + /** * If Orb has ever attempted payment auto-collection for this invoice, this field will * reflect when that attempt occurred. In conjunction with `next_attempt_at`, this can be @@ -1521,11 +1518,7 @@ private constructor( Optional.ofNullable(previouslyAttemptedAt.getNullable("previously_attempted_at")) /** True only if auto-collection is enabled for this invoice. */ - fun enabled(): Optional = Optional.ofNullable(enabled.getNullable("enabled")) - - /** Number of auto-collection payment attempts. */ - fun numAttempts(): Optional = - Optional.ofNullable(numAttempts.getNullable("num_attempts")) + @JsonProperty("enabled") @ExcludeMissing fun _enabled() = enabled /** * If the invoice is scheduled for auto-collection, this field will reflect when the next @@ -1534,6 +1527,9 @@ private constructor( */ @JsonProperty("next_attempt_at") @ExcludeMissing fun _nextAttemptAt() = nextAttemptAt + /** Number of auto-collection payment attempts. */ + @JsonProperty("num_attempts") @ExcludeMissing fun _numAttempts() = numAttempts + /** * If Orb has ever attempted payment auto-collection for this invoice, this field will * reflect when that attempt occurred. In conjunction with `next_attempt_at`, this can be @@ -1546,12 +1542,6 @@ private constructor( @ExcludeMissing fun _previouslyAttemptedAt() = previouslyAttemptedAt - /** True only if auto-collection is enabled for this invoice. */ - @JsonProperty("enabled") @ExcludeMissing fun _enabled() = enabled - - /** Number of auto-collection payment attempts. */ - @JsonProperty("num_attempts") @ExcludeMissing fun _numAttempts() = numAttempts - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1560,10 +1550,10 @@ private constructor( fun validate(): AutoCollection = apply { if (!validated) { - nextAttemptAt() - previouslyAttemptedAt() enabled() + nextAttemptAt() numAttempts() + previouslyAttemptedAt() validated = true } } @@ -1577,21 +1567,27 @@ private constructor( class Builder { - private var nextAttemptAt: JsonField = JsonMissing.of() - private var previouslyAttemptedAt: JsonField = JsonMissing.of() private var enabled: JsonField = JsonMissing.of() + private var nextAttemptAt: JsonField = JsonMissing.of() private var numAttempts: JsonField = JsonMissing.of() + private var previouslyAttemptedAt: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(autoCollection: AutoCollection) = apply { - nextAttemptAt = autoCollection.nextAttemptAt - previouslyAttemptedAt = autoCollection.previouslyAttemptedAt enabled = autoCollection.enabled + nextAttemptAt = autoCollection.nextAttemptAt numAttempts = autoCollection.numAttempts + previouslyAttemptedAt = autoCollection.previouslyAttemptedAt additionalProperties = autoCollection.additionalProperties.toMutableMap() } + /** True only if auto-collection is enabled for this invoice. */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** True only if auto-collection is enabled for this invoice. */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + /** * If the invoice is scheduled for auto-collection, this field will reflect when the * next attempt will occur. If dunning has been exhausted, or auto-collection is not @@ -1609,6 +1605,12 @@ private constructor( this.nextAttemptAt = nextAttemptAt } + /** Number of auto-collection payment attempts. */ + fun numAttempts(numAttempts: Long) = numAttempts(JsonField.of(numAttempts)) + + /** Number of auto-collection payment attempts. */ + fun numAttempts(numAttempts: JsonField) = apply { this.numAttempts = numAttempts } + /** * If Orb has ever attempted payment auto-collection for this invoice, this field will * reflect when that attempt occurred. In conjunction with `next_attempt_at`, this can @@ -1632,18 +1634,6 @@ private constructor( this.previouslyAttemptedAt = previouslyAttemptedAt } - /** True only if auto-collection is enabled for this invoice. */ - fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) - - /** True only if auto-collection is enabled for this invoice. */ - fun enabled(enabled: JsonField) = apply { this.enabled = enabled } - - /** Number of auto-collection payment attempts. */ - fun numAttempts(numAttempts: Long) = numAttempts(JsonField.of(numAttempts)) - - /** Number of auto-collection payment attempts. */ - fun numAttempts(numAttempts: JsonField) = apply { this.numAttempts = numAttempts } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1665,10 +1655,10 @@ private constructor( fun build(): AutoCollection = AutoCollection( - nextAttemptAt, - previouslyAttemptedAt, enabled, + nextAttemptAt, numAttempts, + previouslyAttemptedAt, additionalProperties.toImmutable(), ) } @@ -1678,69 +1668,69 @@ private constructor( return true } - return /* spotless:off */ other is AutoCollection && nextAttemptAt == other.nextAttemptAt && previouslyAttemptedAt == other.previouslyAttemptedAt && enabled == other.enabled && numAttempts == other.numAttempts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AutoCollection && enabled == other.enabled && nextAttemptAt == other.nextAttemptAt && numAttempts == other.numAttempts && previouslyAttemptedAt == other.previouslyAttemptedAt && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(nextAttemptAt, previouslyAttemptedAt, enabled, numAttempts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(enabled, nextAttemptAt, numAttempts, previouslyAttemptedAt, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AutoCollection{nextAttemptAt=$nextAttemptAt, previouslyAttemptedAt=$previouslyAttemptedAt, enabled=$enabled, numAttempts=$numAttempts, additionalProperties=$additionalProperties}" + "AutoCollection{enabled=$enabled, nextAttemptAt=$nextAttemptAt, numAttempts=$numAttempts, previouslyAttemptedAt=$previouslyAttemptedAt, additionalProperties=$additionalProperties}" } @NoAutoDetect class BillingAddress @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), @JsonProperty("postal_code") @ExcludeMissing private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("country") + @JsonProperty("state") @ExcludeMissing - private val country: JsonField = JsonMissing.of(), + private val state: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing @@ -1750,12 +1740,12 @@ private constructor( fun validate(): BillingAddress = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -1769,48 +1759,48 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(billingAddress: BillingAddress) = apply { + city = billingAddress.city + country = billingAddress.country line1 = billingAddress.line1 line2 = billingAddress.line2 - city = billingAddress.city - state = billingAddress.state postalCode = billingAddress.postalCode - country = billingAddress.country + state = billingAddress.state additionalProperties = billingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = line1(JsonField.of(line1)) + fun city(city: String) = city(JsonField.of(city)) - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: String) = line2(JsonField.of(line2)) + fun country(country: String) = country(JsonField.of(country)) - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: String) = city(JsonField.of(city)) + fun line1(line1: String) = line1(JsonField.of(line1)) - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: String) = state(JsonField.of(state)) + fun line2(line2: String) = line2(JsonField.of(line2)) - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: String) = country(JsonField.of(country)) + fun state(state: String) = state(JsonField.of(state)) - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1833,12 +1823,12 @@ private constructor( fun build(): BillingAddress = BillingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1848,17 +1838,17 @@ private constructor( return true } - return /* spotless:off */ other is BillingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BillingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BillingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "BillingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1869,21 +1859,21 @@ private constructor( @JsonProperty("credit_note_number") @ExcludeMissing private val creditNoteNumber: JsonField = JsonMissing.of(), + @JsonProperty("memo") + @ExcludeMissing + private val memo: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), - @JsonProperty("voided_at") - @ExcludeMissing - private val voidedAt: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("memo") + @JsonProperty("voided_at") @ExcludeMissing - private val memo: JsonField = JsonMissing.of(), + private val voidedAt: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -1892,10 +1882,15 @@ private constructor( fun creditNoteNumber(): String = creditNoteNumber.getRequired("credit_note_number") + /** An optional memo supplied on the credit note. */ + fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) + fun reason(): String = reason.getRequired("reason") fun total(): String = total.getRequired("total") + fun type(): String = type.getRequired("type") + /** * If the credit note has a status of `void`, this gives a timestamp when the credit note * was voided. @@ -1903,32 +1898,27 @@ private constructor( fun voidedAt(): Optional = Optional.ofNullable(voidedAt.getNullable("voided_at")) - fun type(): String = type.getRequired("type") - - /** An optional memo supplied on the credit note. */ - fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) - @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("credit_note_number") @ExcludeMissing fun _creditNoteNumber() = creditNoteNumber + /** An optional memo supplied on the credit note. */ + @JsonProperty("memo") @ExcludeMissing fun _memo() = memo + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonProperty("total") @ExcludeMissing fun _total() = total + @JsonProperty("type") @ExcludeMissing fun _type() = type + /** * If the credit note has a status of `void`, this gives a timestamp when the credit note * was voided. */ @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt - @JsonProperty("type") @ExcludeMissing fun _type() = type - - /** An optional memo supplied on the credit note. */ - @JsonProperty("memo") @ExcludeMissing fun _memo() = memo - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1939,11 +1929,11 @@ private constructor( if (!validated) { id() creditNoteNumber() + memo() reason() total() - voidedAt() type() - memo() + voidedAt() validated = true } } @@ -1959,22 +1949,22 @@ private constructor( private var id: JsonField = JsonMissing.of() private var creditNoteNumber: JsonField = JsonMissing.of() + private var memo: JsonField = JsonMissing.of() private var reason: JsonField = JsonMissing.of() private var total: JsonField = JsonMissing.of() - private var voidedAt: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var memo: JsonField = JsonMissing.of() + private var voidedAt: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditNote: CreditNote) = apply { id = creditNote.id creditNoteNumber = creditNote.creditNoteNumber + memo = creditNote.memo reason = creditNote.reason total = creditNote.total - voidedAt = creditNote.voidedAt type = creditNote.type - memo = creditNote.memo + voidedAt = creditNote.voidedAt additionalProperties = creditNote.additionalProperties.toMutableMap() } @@ -1989,6 +1979,12 @@ private constructor( this.creditNoteNumber = creditNoteNumber } + /** An optional memo supplied on the credit note. */ + fun memo(memo: String) = memo(JsonField.of(memo)) + + /** An optional memo supplied on the credit note. */ + fun memo(memo: JsonField) = apply { this.memo = memo } + fun reason(reason: String) = reason(JsonField.of(reason)) fun reason(reason: JsonField) = apply { this.reason = reason } @@ -1997,6 +1993,10 @@ private constructor( fun total(total: JsonField) = apply { this.total = total } + fun type(type: String) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + /** * If the credit note has a status of `void`, this gives a timestamp when the credit * note was voided. @@ -2009,16 +2009,6 @@ private constructor( */ fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt } - fun type(type: String) = type(JsonField.of(type)) - - fun type(type: JsonField) = apply { this.type = type } - - /** An optional memo supplied on the credit note. */ - fun memo(memo: String) = memo(JsonField.of(memo)) - - /** An optional memo supplied on the credit note. */ - fun memo(memo: JsonField) = apply { this.memo = memo } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2042,11 +2032,11 @@ private constructor( CreditNote( id, creditNoteNumber, + memo, reason, total, - voidedAt, type, - memo, + voidedAt, additionalProperties.toImmutable(), ) } @@ -2056,17 +2046,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditNote && id == other.id && creditNoteNumber == other.creditNoteNumber && reason == other.reason && total == other.total && voidedAt == other.voidedAt && type == other.type && memo == other.memo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditNote && id == other.id && creditNoteNumber == other.creditNoteNumber && memo == other.memo && reason == other.reason && total == other.total && type == other.type && voidedAt == other.voidedAt && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, creditNoteNumber, reason, total, voidedAt, type, memo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, creditNoteNumber, memo, reason, total, type, voidedAt, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditNote{id=$id, creditNoteNumber=$creditNoteNumber, reason=$reason, total=$total, voidedAt=$voidedAt, type=$type, memo=$memo, additionalProperties=$additionalProperties}" + "CreditNote{id=$id, creditNoteNumber=$creditNoteNumber, memo=$memo, reason=$reason, total=$total, type=$type, voidedAt=$voidedAt, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2187,31 +2177,31 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("starting_balance") - @ExcludeMissing - private val startingBalance: JsonField = JsonMissing.of(), - @JsonProperty("ending_balance") + @JsonProperty("action") @ExcludeMissing - private val endingBalance: JsonField = JsonMissing.of(), + private val action: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), - @JsonProperty("action") + @JsonProperty("created_at") @ExcludeMissing - private val action: JsonField = JsonMissing.of(), + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("credit_note") + @ExcludeMissing + private val creditNote: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), + @JsonProperty("ending_balance") + @ExcludeMissing + private val endingBalance: JsonField = JsonMissing.of(), @JsonProperty("invoice") @ExcludeMissing private val invoice: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("credit_note") + @JsonProperty("starting_balance") @ExcludeMissing - private val creditNote: JsonField = JsonMissing.of(), + private val startingBalance: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -2219,14 +2209,20 @@ private constructor( /** A unique id for this transaction. */ fun id(): String = id.getRequired("id") + fun action(): Action = action.getRequired("action") + + /** The value of the amount changed in the transaction. */ + fun amount(): String = amount.getRequired("amount") + /** The creation time of this transaction. */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - fun startingBalance(): String = startingBalance.getRequired("starting_balance") + fun creditNote(): Optional = + Optional.ofNullable(creditNote.getNullable("credit_note")) + + /** An optional description provided for manual customer balance adjustments. */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** * The new value of the customer's balance prior to the transaction, in the customer's @@ -2234,33 +2230,31 @@ private constructor( */ fun endingBalance(): String = endingBalance.getRequired("ending_balance") - /** The value of the amount changed in the transaction. */ - fun amount(): String = amount.getRequired("amount") - - fun action(): Action = action.getRequired("action") - - /** An optional description provided for manual customer balance adjustments. */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - fun invoice(): Optional = Optional.ofNullable(invoice.getNullable("invoice")) - fun type(): Type = type.getRequired("type") + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + fun startingBalance(): String = startingBalance.getRequired("starting_balance") - fun creditNote(): Optional = - Optional.ofNullable(creditNote.getNullable("credit_note")) + fun type(): Type = type.getRequired("type") /** A unique id for this transaction. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("action") @ExcludeMissing fun _action() = action + + /** The value of the amount changed in the transaction. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + /** The creation time of this transaction. */ @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** - * The original value of the customer's balance prior to the transaction, in the customer's - * currency. - */ - @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance + @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + + /** An optional description provided for manual customer balance adjustments. */ + @JsonProperty("description") @ExcludeMissing fun _description() = description /** * The new value of the customer's balance prior to the transaction, in the customer's @@ -2268,19 +2262,15 @@ private constructor( */ @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance - /** The value of the amount changed in the transaction. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("action") @ExcludeMissing fun _action() = action - - /** An optional description provided for manual customer balance adjustments. */ - @JsonProperty("description") @ExcludeMissing fun _description() = description - @JsonProperty("invoice") @ExcludeMissing fun _invoice() = invoice - @JsonProperty("type") @ExcludeMissing fun _type() = type + /** + * The original value of the customer's balance prior to the transaction, in the customer's + * currency. + */ + @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance - @JsonProperty("credit_note") @ExcludeMissing fun _creditNote() = creditNote + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing @@ -2291,15 +2281,15 @@ private constructor( fun validate(): CustomerBalanceTransaction = apply { if (!validated) { id() - createdAt() - startingBalance() - endingBalance() - amount() action() + amount() + createdAt() + creditNote().map { it.validate() } description() + endingBalance() invoice().map { it.validate() } + startingBalance() type() - creditNote().map { it.validate() } validated = true } } @@ -2314,29 +2304,29 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var startingBalance: JsonField = JsonMissing.of() - private var endingBalance: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var action: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var creditNote: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() + private var endingBalance: JsonField = JsonMissing.of() private var invoice: JsonField = JsonMissing.of() + private var startingBalance: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var creditNote: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(customerBalanceTransaction: CustomerBalanceTransaction) = apply { id = customerBalanceTransaction.id - createdAt = customerBalanceTransaction.createdAt - startingBalance = customerBalanceTransaction.startingBalance - endingBalance = customerBalanceTransaction.endingBalance - amount = customerBalanceTransaction.amount action = customerBalanceTransaction.action + amount = customerBalanceTransaction.amount + createdAt = customerBalanceTransaction.createdAt + creditNote = customerBalanceTransaction.creditNote description = customerBalanceTransaction.description + endingBalance = customerBalanceTransaction.endingBalance invoice = customerBalanceTransaction.invoice + startingBalance = customerBalanceTransaction.startingBalance type = customerBalanceTransaction.type - creditNote = customerBalanceTransaction.creditNote additionalProperties = customerBalanceTransaction.additionalProperties.toMutableMap() } @@ -2347,6 +2337,16 @@ private constructor( /** A unique id for this transaction. */ fun id(id: JsonField) = apply { this.id = id } + fun action(action: Action) = action(JsonField.of(action)) + + fun action(action: JsonField) = apply { this.action = action } + + /** The value of the amount changed in the transaction. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The value of the amount changed in the transaction. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The creation time of this transaction. */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -2355,19 +2355,18 @@ private constructor( this.createdAt = createdAt } - /** - * The original value of the customer's balance prior to the transaction, in the - * customer's currency. - */ - fun startingBalance(startingBalance: String) = - startingBalance(JsonField.of(startingBalance)) + fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) - /** - * The original value of the customer's balance prior to the transaction, in the - * customer's currency. - */ - fun startingBalance(startingBalance: JsonField) = apply { - this.startingBalance = startingBalance + fun creditNote(creditNote: JsonField) = apply { + this.creditNote = creditNote + } + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: String) = description(JsonField.of(description)) + + /** An optional description provided for manual customer balance adjustments. */ + fun description(description: JsonField) = apply { + this.description = description } /** @@ -2384,38 +2383,29 @@ private constructor( this.endingBalance = endingBalance } - /** The value of the amount changed in the transaction. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The value of the amount changed in the transaction. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun action(action: Action) = action(JsonField.of(action)) + fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice)) - fun action(action: JsonField) = apply { this.action = action } + fun invoice(invoice: JsonField) = apply { this.invoice = invoice } - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: String) = description(JsonField.of(description)) + /** + * The original value of the customer's balance prior to the transaction, in the + * customer's currency. + */ + fun startingBalance(startingBalance: String) = + startingBalance(JsonField.of(startingBalance)) - /** An optional description provided for manual customer balance adjustments. */ - fun description(description: JsonField) = apply { - this.description = description + /** + * The original value of the customer's balance prior to the transaction, in the + * customer's currency. + */ + fun startingBalance(startingBalance: JsonField) = apply { + this.startingBalance = startingBalance } - fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice)) - - fun invoice(invoice: JsonField) = apply { this.invoice = invoice } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } - fun creditNote(creditNote: CreditNote) = creditNote(JsonField.of(creditNote)) - - fun creditNote(creditNote: JsonField) = apply { - this.creditNote = creditNote - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2438,15 +2428,15 @@ private constructor( fun build(): CustomerBalanceTransaction = CustomerBalanceTransaction( id, - createdAt, - startingBalance, - endingBalance, - amount, action, + amount, + createdAt, + creditNote, description, + endingBalance, invoice, + startingBalance, type, - creditNote, additionalProperties.toImmutable(), ) } @@ -2799,17 +2789,17 @@ private constructor( return true } - return /* spotless:off */ other is CustomerBalanceTransaction && id == other.id && createdAt == other.createdAt && startingBalance == other.startingBalance && endingBalance == other.endingBalance && amount == other.amount && action == other.action && description == other.description && invoice == other.invoice && type == other.type && creditNote == other.creditNote && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransaction && id == other.id && action == other.action && amount == other.amount && createdAt == other.createdAt && creditNote == other.creditNote && description == other.description && endingBalance == other.endingBalance && invoice == other.invoice && startingBalance == other.startingBalance && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, createdAt, startingBalance, endingBalance, amount, action, description, invoice, type, creditNote, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, action, amount, createdAt, creditNote, description, endingBalance, invoice, startingBalance, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CustomerBalanceTransaction{id=$id, createdAt=$createdAt, startingBalance=$startingBalance, endingBalance=$endingBalance, amount=$amount, action=$action, description=$description, invoice=$invoice, type=$type, creditNote=$creditNote, additionalProperties=$additionalProperties}" + "CustomerBalanceTransaction{id=$id, action=$action, amount=$amount, createdAt=$createdAt, creditNote=$creditNote, description=$description, endingBalance=$endingBalance, invoice=$invoice, startingBalance=$startingBalance, type=$type, additionalProperties=$additionalProperties}" } /** @@ -4091,6 +4081,7 @@ private constructor( class LineItem @JsonCreator private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), @@ -4103,94 +4094,73 @@ private constructor( @JsonProperty("grouping") @ExcludeMissing private val grouping: JsonField = JsonMissing.of(), - @JsonProperty("minimum") - @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("minimum") + @ExcludeMissing + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("price") + @ExcludeMissing + private val price: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("subtotal") - @ExcludeMissing - private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("sub_line_items") @ExcludeMissing private val subLineItems: JsonField> = JsonMissing.of(), + @JsonProperty("subtotal") + @ExcludeMissing + private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("tax_amounts") @ExcludeMissing private val taxAmounts: JsonField> = JsonMissing.of(), - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("price") - @ExcludeMissing - private val price: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** A unique ID for this line item. */ + fun id(): String = id.getRequired("id") + /** The final amount after any discounts or minimums. */ fun amount(): String = amount.getRequired("amount") fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) /** The end date of the range of time applied for this line item's price. */ - fun endDate(): OffsetDateTime = endDate.getRequired("end_date") - - /** - * [DEPRECATED] For configured prices that are split by a grouping key, this will be - * populated with the key and a value. The `amount` and `subtotal` will be the values for - * this particular grouping. - */ - fun grouping(): Optional = Optional.ofNullable(grouping.getNullable("grouping")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) - - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - - /** The name of the price associated with this line item. */ - fun name(): String = name.getRequired("name") - - fun quantity(): Double = quantity.getRequired("quantity") - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(): List = subLineItems.getRequired("sub_line_items") + fun endDate(): OffsetDateTime = endDate.getRequired("end_date") /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. + * [DEPRECATED] For configured prices that are split by a grouping key, this will be + * populated with the key and a value. The `amount` and `subtotal` will be the values for + * this particular grouping. */ - fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") + fun grouping(): Optional = Optional.ofNullable(grouping.getNullable("grouping")) - /** A unique ID for this line item. */ - fun id(): String = id.getRequired("id") + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) + + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + /** The name of the price associated with this line item. */ + fun name(): String = name.getRequired("name") /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -4422,6 +4392,29 @@ private constructor( */ fun price(): Optional = Optional.ofNullable(price.getNullable("price")) + fun quantity(): Double = quantity.getRequired("quantity") + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(): List = subLineItems.getRequired("sub_line_items") + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(): String = subtotal.getRequired("subtotal") + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") + + /** A unique ID for this line item. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The final amount after any discounts or minimums. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @@ -4437,39 +4430,16 @@ private constructor( */ @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum - - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - /** The name of the price associated with this line item. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - - /** The start date of the range of time applied for this line item's price. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The line amount before any line item-specific discounts or minimums. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal - - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - @JsonProperty("sub_line_items") @ExcludeMissing fun _subLineItems() = subLineItems + @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - @JsonProperty("tax_amounts") @ExcludeMissing fun _taxAmounts() = taxAmounts + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** A unique ID for this line item. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The name of the price associated with this line item. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -4701,6 +4671,26 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + + /** The start date of the range of time applied for this line item's price. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + @JsonProperty("sub_line_items") @ExcludeMissing fun _subLineItems() = subLineItems + + /** The line amount before any line item-specific discounts or minimums. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + @JsonProperty("tax_amounts") @ExcludeMissing fun _taxAmounts() = taxAmounts + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4709,22 +4699,22 @@ private constructor( fun validate(): LineItem = apply { if (!validated) { + id() amount() discount() endDate() grouping() - minimum().map { it.validate() } - minimumAmount() maximum().map { it.validate() } maximumAmount() + minimum().map { it.validate() } + minimumAmount() name() + price() quantity() startDate() - subtotal() subLineItems() + subtotal() taxAmounts().forEach { it.validate() } - id() - price() validated = true } } @@ -4738,45 +4728,51 @@ private constructor( class Builder { + private var id: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() private var grouping: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var subtotal: JsonField = JsonMissing.of() private var subLineItems: JsonField> = JsonMissing.of() + private var subtotal: JsonField = JsonMissing.of() private var taxAmounts: JsonField> = JsonMissing.of() - private var id: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(lineItem: LineItem) = apply { + id = lineItem.id amount = lineItem.amount discount = lineItem.discount endDate = lineItem.endDate grouping = lineItem.grouping - minimum = lineItem.minimum - minimumAmount = lineItem.minimumAmount maximum = lineItem.maximum maximumAmount = lineItem.maximumAmount + minimum = lineItem.minimum + minimumAmount = lineItem.minimumAmount name = lineItem.name + price = lineItem.price quantity = lineItem.quantity startDate = lineItem.startDate - subtotal = lineItem.subtotal subLineItems = lineItem.subLineItems + subtotal = lineItem.subtotal taxAmounts = lineItem.taxAmounts - id = lineItem.id - price = lineItem.price additionalProperties = lineItem.additionalProperties.toMutableMap() } + /** A unique ID for this line item. */ + fun id(id: String) = id(JsonField.of(id)) + + /** A unique ID for this line item. */ + fun id(id: JsonField) = apply { this.id = id } + /** The final amount after any discounts or minimums. */ fun amount(amount: String) = amount(JsonField.of(amount)) @@ -4807,16 +4803,6 @@ private constructor( */ fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - - fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) fun maximum(maximum: JsonField) = apply { this.maximum = maximum } @@ -4827,64 +4813,21 @@ private constructor( this.maximumAmount = maximumAmount } - /** The name of the price associated with this line item. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price associated with this line item. */ - fun name(name: JsonField) = apply { this.name = name } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(subLineItems: List) = - subLineItems(JsonField.of(subLineItems)) + fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(subLineItems: JsonField>) = apply { - this.subLineItems = subLineItems - } + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - fun taxAmounts(taxAmounts: List) = taxAmounts(JsonField.of(taxAmounts)) + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - fun taxAmounts(taxAmounts: JsonField>) = apply { - this.taxAmounts = taxAmounts + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount } - /** A unique ID for this line item. */ - fun id(id: String) = id(JsonField.of(id)) + /** The name of the price associated with this line item. */ + fun name(name: String) = name(JsonField.of(name)) - /** A unique ID for this line item. */ - fun id(id: JsonField) = apply { this.id = id } + /** The name of the price associated with this line item. */ + fun name(name: JsonField) = apply { this.name = name } /** * The Price resource represents a price that can be billed on a subscription, resulting @@ -5346,6 +5289,53 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(subLineItems: List) = + subLineItems(JsonField.of(subLineItems)) + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(subLineItems: JsonField>) = apply { + this.subLineItems = subLineItems + } + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(taxAmounts: List) = taxAmounts(JsonField.of(taxAmounts)) + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(taxAmounts: JsonField>) = apply { + this.taxAmounts = taxAmounts + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5367,22 +5357,22 @@ private constructor( fun build(): LineItem = LineItem( + id, amount, discount, endDate, grouping, - minimum, - minimumAmount, maximum, maximumAmount, + minimum, + minimumAmount, name, + price, quantity, startDate, - subtotal, subLineItems.map { it.toImmutable() }, + subtotal, taxAmounts.map { it.toImmutable() }, - id, - price, additionalProperties.toImmutable(), ) } @@ -5391,19 +5381,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -5412,7 +5399,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -5422,6 +5409,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5430,8 +5420,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -5445,26 +5435,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -5480,6 +5461,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5504,8 +5494,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -5515,36 +5505,33 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } @NoAutoDetect class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -5553,7 +5540,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -5563,6 +5550,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5571,8 +5561,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -5586,26 +5576,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -5621,6 +5602,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5645,8 +5635,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -5656,17 +5646,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } @JsonDeserialize(using = SubLineItem.Deserializer::class) @@ -5841,21 +5831,21 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), + @JsonProperty("matrix_config") + @ExcludeMissing + private val matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") - @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("matrix_config") - @ExcludeMissing - private val matrixConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5863,30 +5853,30 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + + fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) - fun type(): Type = type.getRequired("type") - fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") - /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + + @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5896,11 +5886,11 @@ private constructor( fun validate(): MatrixSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } + matrixConfig().validate() name() quantity() - grouping().map { it.validate() } type() - matrixConfig().validate() validated = true } } @@ -5915,21 +5905,21 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() + private var matrixConfig: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var matrixConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixSubLineItem: MatrixSubLineItem) = apply { amount = matrixSubLineItem.amount + grouping = matrixSubLineItem.grouping + matrixConfig = matrixSubLineItem.matrixConfig name = matrixSubLineItem.name quantity = matrixSubLineItem.quantity - grouping = matrixSubLineItem.grouping type = matrixSubLineItem.type - matrixConfig = matrixSubLineItem.matrixConfig additionalProperties = matrixSubLineItem.additionalProperties.toMutableMap() } @@ -5939,6 +5929,17 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + + fun matrixConfig(matrixConfig: MatrixConfig) = + matrixConfig(JsonField.of(matrixConfig)) + + fun matrixConfig(matrixConfig: JsonField) = apply { + this.matrixConfig = matrixConfig + } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -5947,21 +5948,10 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } - fun matrixConfig(matrixConfig: MatrixConfig) = - matrixConfig(JsonField.of(matrixConfig)) - - fun matrixConfig(matrixConfig: JsonField) = apply { - this.matrixConfig = matrixConfig - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5987,11 +5977,11 @@ private constructor( fun build(): MatrixSubLineItem = MatrixSubLineItem( amount, + grouping, + matrixConfig, name, quantity, - grouping, type, - matrixConfig, additionalProperties.toImmutable(), ) } @@ -6278,17 +6268,17 @@ private constructor( return true } - return /* spotless:off */ other is MatrixSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && matrixConfig == other.matrixConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixSubLineItem && amount == other.amount && grouping == other.grouping && matrixConfig == other.matrixConfig && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, matrixConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, matrixConfig, name, quantity, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, matrixConfig=$matrixConfig, additionalProperties=$additionalProperties}" + "MatrixSubLineItem{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -6298,21 +6288,21 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") + @JsonProperty("tier_config") @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), + private val tierConfig: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("tier_config") - @ExcludeMissing - private val tierConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -6320,30 +6310,30 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) + fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") fun type(): Type = type.getRequired("type") - fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") - /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("tier_config") @ExcludeMissing fun _tierConfig() = tierConfig @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("tier_config") @ExcludeMissing fun _tierConfig() = tierConfig - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6353,11 +6343,11 @@ private constructor( fun validate(): TierSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } name() quantity() - grouping().map { it.validate() } - type() tierConfig().validate() + type() validated = true } } @@ -6372,21 +6362,21 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() private var tierConfig: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tierSubLineItem: TierSubLineItem) = apply { amount = tierSubLineItem.amount + grouping = tierSubLineItem.grouping name = tierSubLineItem.name quantity = tierSubLineItem.quantity - grouping = tierSubLineItem.grouping - type = tierSubLineItem.type tierConfig = tierSubLineItem.tierConfig + type = tierSubLineItem.type additionalProperties = tierSubLineItem.additionalProperties.toMutableMap() } @@ -6396,6 +6386,10 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -6404,20 +6398,16 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - - fun type(type: Type) = type(JsonField.of(type)) - - fun type(type: JsonField) = apply { this.type = type } - fun tierConfig(tierConfig: TierConfig) = tierConfig(JsonField.of(tierConfig)) fun tierConfig(tierConfig: JsonField) = apply { this.tierConfig = tierConfig } + fun type(type: Type) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6443,11 +6433,11 @@ private constructor( fun build(): TierSubLineItem = TierSubLineItem( amount, + grouping, name, quantity, - grouping, - type, tierConfig, + type, additionalProperties.toImmutable(), ) } @@ -6761,17 +6751,17 @@ private constructor( return true } - return /* spotless:off */ other is TierSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && tierConfig == other.tierConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TierSubLineItem && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && tierConfig == other.tierConfig && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, tierConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, name, quantity, tierConfig, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TierSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, tierConfig=$tierConfig, additionalProperties=$additionalProperties}" + "TierSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -6781,15 +6771,15 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") - @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @@ -6800,24 +6790,24 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) - fun type(): Type = type.getRequired("type") /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @@ -6829,9 +6819,9 @@ private constructor( fun validate(): OtherSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } name() quantity() - grouping().map { it.validate() } type() validated = true } @@ -6847,18 +6837,18 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(otherSubLineItem: OtherSubLineItem) = apply { amount = otherSubLineItem.amount + grouping = otherSubLineItem.grouping name = otherSubLineItem.name quantity = otherSubLineItem.quantity - grouping = otherSubLineItem.grouping type = otherSubLineItem.type additionalProperties = otherSubLineItem.additionalProperties.toMutableMap() } @@ -6869,6 +6859,10 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -6877,10 +6871,6 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } @@ -6910,9 +6900,9 @@ private constructor( fun build(): OtherSubLineItem = OtherSubLineItem( amount, + grouping, name, quantity, - grouping, type, additionalProperties.toImmutable(), ) @@ -7092,17 +7082,17 @@ private constructor( return true } - return /* spotless:off */ other is OtherSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is OtherSubLineItem && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, name, quantity, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "OtherSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, additionalProperties=$additionalProperties}" + "OtherSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } } @@ -7110,19 +7100,22 @@ private constructor( class TaxAmount @JsonCreator private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_description") @ExcludeMissing private val taxRateDescription: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_percentage") @ExcludeMissing private val taxRatePercentage: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The amount of additional tax incurred by this tax rate. */ + fun amount(): String = amount.getRequired("amount") + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(): String = taxRateDescription.getRequired("tax_rate_description") @@ -7132,7 +7125,7 @@ private constructor( Optional.ofNullable(taxRatePercentage.getNullable("tax_rate_percentage")) /** The amount of additional tax incurred by this tax rate. */ - fun amount(): String = amount.getRequired("amount") + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** The human-readable description of the applied tax rate. */ @JsonProperty("tax_rate_description") @@ -7141,11 +7134,8 @@ private constructor( /** The tax rate percentage, out of 100. */ @JsonProperty("tax_rate_percentage") - @ExcludeMissing - fun _taxRatePercentage() = taxRatePercentage - - /** The amount of additional tax incurred by this tax rate. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @ExcludeMissing + fun _taxRatePercentage() = taxRatePercentage @JsonAnyGetter @ExcludeMissing @@ -7155,9 +7145,9 @@ private constructor( fun validate(): TaxAmount = apply { if (!validated) { + amount() taxRateDescription() taxRatePercentage() - amount() validated = true } } @@ -7171,19 +7161,25 @@ private constructor( class Builder { + private var amount: JsonField = JsonMissing.of() private var taxRateDescription: JsonField = JsonMissing.of() private var taxRatePercentage: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(taxAmount: TaxAmount) = apply { + amount = taxAmount.amount taxRateDescription = taxAmount.taxRateDescription taxRatePercentage = taxAmount.taxRatePercentage - amount = taxAmount.amount additionalProperties = taxAmount.additionalProperties.toMutableMap() } + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(taxRateDescription: String) = taxRateDescription(JsonField.of(taxRateDescription)) @@ -7202,12 +7198,6 @@ private constructor( this.taxRatePercentage = taxRatePercentage } - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7232,9 +7222,9 @@ private constructor( fun build(): TaxAmount = TaxAmount( + amount, taxRateDescription, taxRatePercentage, - amount, additionalProperties.toImmutable(), ) } @@ -7244,17 +7234,17 @@ private constructor( return true } - return /* spotless:off */ other is TaxAmount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TaxAmount && amount == other.amount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(taxRateDescription, taxRatePercentage, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, taxRateDescription, taxRatePercentage, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TaxAmount{taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, amount=$amount, additionalProperties=$additionalProperties}" + "TaxAmount{amount=$amount, taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -7262,36 +7252,33 @@ private constructor( return true } - return /* spotless:off */ other is LineItem && amount == other.amount && discount == other.discount && endDate == other.endDate && grouping == other.grouping && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && name == other.name && quantity == other.quantity && startDate == other.startDate && subtotal == other.subtotal && subLineItems == other.subLineItems && taxAmounts == other.taxAmounts && id == other.id && price == other.price && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LineItem && id == other.id && amount == other.amount && discount == other.discount && endDate == other.endDate && grouping == other.grouping && maximum == other.maximum && maximumAmount == other.maximumAmount && minimum == other.minimum && minimumAmount == other.minimumAmount && name == other.name && price == other.price && quantity == other.quantity && startDate == other.startDate && subLineItems == other.subLineItems && subtotal == other.subtotal && taxAmounts == other.taxAmounts && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, discount, endDate, grouping, minimum, minimumAmount, maximum, maximumAmount, name, quantity, startDate, subtotal, subLineItems, taxAmounts, id, price, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, discount, endDate, grouping, maximum, maximumAmount, minimum, minimumAmount, name, price, quantity, startDate, subLineItems, subtotal, taxAmounts, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LineItem{amount=$amount, discount=$discount, endDate=$endDate, grouping=$grouping, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, name=$name, quantity=$quantity, startDate=$startDate, subtotal=$subtotal, subLineItems=$subLineItems, taxAmounts=$taxAmounts, id=$id, price=$price, additionalProperties=$additionalProperties}" + "LineItem{id=$id, amount=$amount, discount=$discount, endDate=$endDate, grouping=$grouping, maximum=$maximum, maximumAmount=$maximumAmount, minimum=$minimum, minimumAmount=$minimumAmount, name=$name, price=$price, quantity=$quantity, startDate=$startDate, subLineItems=$subLineItems, subtotal=$subtotal, taxAmounts=$taxAmounts, additionalProperties=$additionalProperties}" } @NoAutoDetect class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this * can be a subset of prices. @@ -7300,7 +7287,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this @@ -7310,6 +7297,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7318,8 +7308,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -7333,25 +7323,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -7367,6 +7349,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7388,8 +7378,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -7399,17 +7389,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -7496,19 +7486,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this * can be a subset of prices. @@ -7517,7 +7504,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this @@ -7527,6 +7514,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7535,8 +7525,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -7550,25 +7540,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -7584,6 +7566,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7605,8 +7595,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -7616,17 +7606,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -7634,21 +7624,21 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), @JsonProperty("payment_provider") @ExcludeMissing private val paymentProvider: JsonField = JsonMissing.of(), @JsonProperty("payment_provider_id") @ExcludeMissing private val paymentProviderId: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), @JsonProperty("succeeded") @ExcludeMissing private val succeeded: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -7656,6 +7646,12 @@ private constructor( /** The ID of the payment attempt. */ fun id(): String = id.getRequired("id") + /** The amount of the payment attempt. */ + fun amount(): String = amount.getRequired("amount") + + /** The time at which the payment attempt was created. */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + /** The payment provider that attempted to collect the payment. */ fun paymentProvider(): Optional = Optional.ofNullable(paymentProvider.getNullable("payment_provider")) @@ -7664,18 +7660,18 @@ private constructor( fun paymentProviderId(): Optional = Optional.ofNullable(paymentProviderId.getNullable("payment_provider_id")) - /** The amount of the payment attempt. */ - fun amount(): String = amount.getRequired("amount") - /** Whether the payment attempt succeeded. */ fun succeeded(): Boolean = succeeded.getRequired("succeeded") - /** The time at which the payment attempt was created. */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** The ID of the payment attempt. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The amount of the payment attempt. */ + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + + /** The time at which the payment attempt was created. */ + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + /** The payment provider that attempted to collect the payment. */ @JsonProperty("payment_provider") @ExcludeMissing fun _paymentProvider() = paymentProvider @@ -7684,15 +7680,9 @@ private constructor( @ExcludeMissing fun _paymentProviderId() = paymentProviderId - /** The amount of the payment attempt. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - /** Whether the payment attempt succeeded. */ @JsonProperty("succeeded") @ExcludeMissing fun _succeeded() = succeeded - /** The time at which the payment attempt was created. */ - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7702,11 +7692,11 @@ private constructor( fun validate(): PaymentAttempt = apply { if (!validated) { id() + amount() + createdAt() paymentProvider() paymentProviderId() - amount() succeeded() - createdAt() validated = true } } @@ -7721,21 +7711,21 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var paymentProvider: JsonField = JsonMissing.of() private var paymentProviderId: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var succeeded: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(paymentAttempt: PaymentAttempt) = apply { id = paymentAttempt.id + amount = paymentAttempt.amount + createdAt = paymentAttempt.createdAt paymentProvider = paymentAttempt.paymentProvider paymentProviderId = paymentAttempt.paymentProviderId - amount = paymentAttempt.amount succeeded = paymentAttempt.succeeded - createdAt = paymentAttempt.createdAt additionalProperties = paymentAttempt.additionalProperties.toMutableMap() } @@ -7745,6 +7735,20 @@ private constructor( /** The ID of the payment attempt. */ fun id(id: JsonField) = apply { this.id = id } + /** The amount of the payment attempt. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount of the payment attempt. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** The time at which the payment attempt was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** The time at which the payment attempt was created. */ + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + /** The payment provider that attempted to collect the payment. */ fun paymentProvider(paymentProvider: PaymentProvider) = paymentProvider(JsonField.of(paymentProvider)) @@ -7763,26 +7767,12 @@ private constructor( this.paymentProviderId = paymentProviderId } - /** The amount of the payment attempt. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The amount of the payment attempt. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - /** Whether the payment attempt succeeded. */ fun succeeded(succeeded: Boolean) = succeeded(JsonField.of(succeeded)) /** Whether the payment attempt succeeded. */ fun succeeded(succeeded: JsonField) = apply { this.succeeded = succeeded } - /** The time at which the payment attempt was created. */ - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** The time at which the payment attempt was created. */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7805,11 +7795,11 @@ private constructor( fun build(): PaymentAttempt = PaymentAttempt( id, + amount, + createdAt, paymentProvider, paymentProviderId, - amount, succeeded, - createdAt, additionalProperties.toImmutable(), ) } @@ -7870,69 +7860,69 @@ private constructor( return true } - return /* spotless:off */ other is PaymentAttempt && id == other.id && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && amount == other.amount && succeeded == other.succeeded && createdAt == other.createdAt && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PaymentAttempt && id == other.id && amount == other.amount && createdAt == other.createdAt && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && succeeded == other.succeeded && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, paymentProvider, paymentProviderId, amount, succeeded, createdAt, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, createdAt, paymentProvider, paymentProviderId, succeeded, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PaymentAttempt{id=$id, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, amount=$amount, succeeded=$succeeded, createdAt=$createdAt, additionalProperties=$additionalProperties}" + "PaymentAttempt{id=$id, amount=$amount, createdAt=$createdAt, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, succeeded=$succeeded, additionalProperties=$additionalProperties}" } @NoAutoDetect class ShippingAddress @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - private val city: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - private val state: JsonField = JsonMissing.of(), @JsonProperty("postal_code") @ExcludeMissing private val postalCode: JsonField = JsonMissing.of(), - @JsonProperty("country") + @JsonProperty("state") @ExcludeMissing - private val country: JsonField = JsonMissing.of(), + private val state: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing @@ -7942,12 +7932,12 @@ private constructor( fun validate(): ShippingAddress = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -7961,48 +7951,48 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(shippingAddress: ShippingAddress) = apply { + city = shippingAddress.city + country = shippingAddress.country line1 = shippingAddress.line1 line2 = shippingAddress.line2 - city = shippingAddress.city - state = shippingAddress.state postalCode = shippingAddress.postalCode - country = shippingAddress.country + state = shippingAddress.state additionalProperties = shippingAddress.additionalProperties.toMutableMap() } - fun line1(line1: String) = line1(JsonField.of(line1)) + fun city(city: String) = city(JsonField.of(city)) - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: String) = line2(JsonField.of(line2)) + fun country(country: String) = country(JsonField.of(country)) - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: String) = city(JsonField.of(city)) + fun line1(line1: String) = line1(JsonField.of(line1)) - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: String) = state(JsonField.of(state)) + fun line2(line2: String) = line2(JsonField.of(line2)) - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: String) = country(JsonField.of(country)) + fun state(state: String) = state(JsonField.of(state)) - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8025,12 +8015,12 @@ private constructor( fun build(): ShippingAddress = ShippingAddress( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -8040,17 +8030,17 @@ private constructor( return true } - return /* spotless:off */ other is ShippingAddress && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ShippingAddress && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ShippingAddress{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } class Status @@ -8220,15 +8210,15 @@ private constructor( return true } - return /* spotless:off */ other is InvoiceFetchUpcomingResponse && metadata == other.metadata && voidedAt == other.voidedAt && paidAt == other.paidAt && issuedAt == other.issuedAt && scheduledIssueAt == other.scheduledIssueAt && autoCollection == other.autoCollection && issueFailedAt == other.issueFailedAt && syncFailedAt == other.syncFailedAt && paymentFailedAt == other.paymentFailedAt && paymentStartedAt == other.paymentStartedAt && amountDue == other.amountDue && createdAt == other.createdAt && currency == other.currency && customer == other.customer && discount == other.discount && discounts == other.discounts && dueDate == other.dueDate && id == other.id && invoicePdf == other.invoicePdf && invoiceNumber == other.invoiceNumber && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && lineItems == other.lineItems && subscription == other.subscription && subtotal == other.subtotal && total == other.total && customerBalanceTransactions == other.customerBalanceTransactions && status == other.status && invoiceSource == other.invoiceSource && shippingAddress == other.shippingAddress && billingAddress == other.billingAddress && hostedInvoiceUrl == other.hostedInvoiceUrl && willAutoIssue == other.willAutoIssue && eligibleToIssueAt == other.eligibleToIssueAt && customerTaxId == other.customerTaxId && memo == other.memo && creditNotes == other.creditNotes && paymentAttempts == other.paymentAttempts && targetDate == other.targetDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceFetchUpcomingResponse && id == other.id && amountDue == other.amountDue && autoCollection == other.autoCollection && billingAddress == other.billingAddress && createdAt == other.createdAt && creditNotes == other.creditNotes && currency == other.currency && customer == other.customer && customerBalanceTransactions == other.customerBalanceTransactions && customerTaxId == other.customerTaxId && discount == other.discount && discounts == other.discounts && dueDate == other.dueDate && eligibleToIssueAt == other.eligibleToIssueAt && hostedInvoiceUrl == other.hostedInvoiceUrl && invoiceNumber == other.invoiceNumber && invoicePdf == other.invoicePdf && invoiceSource == other.invoiceSource && issueFailedAt == other.issueFailedAt && issuedAt == other.issuedAt && lineItems == other.lineItems && maximum == other.maximum && maximumAmount == other.maximumAmount && memo == other.memo && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && paidAt == other.paidAt && paymentAttempts == other.paymentAttempts && paymentFailedAt == other.paymentFailedAt && paymentStartedAt == other.paymentStartedAt && scheduledIssueAt == other.scheduledIssueAt && shippingAddress == other.shippingAddress && status == other.status && subscription == other.subscription && subtotal == other.subtotal && syncFailedAt == other.syncFailedAt && targetDate == other.targetDate && total == other.total && voidedAt == other.voidedAt && willAutoIssue == other.willAutoIssue && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, voidedAt, paidAt, issuedAt, scheduledIssueAt, autoCollection, issueFailedAt, syncFailedAt, paymentFailedAt, paymentStartedAt, amountDue, createdAt, currency, customer, discount, discounts, dueDate, id, invoicePdf, invoiceNumber, minimum, minimumAmount, maximum, maximumAmount, lineItems, subscription, subtotal, total, customerBalanceTransactions, status, invoiceSource, shippingAddress, billingAddress, hostedInvoiceUrl, willAutoIssue, eligibleToIssueAt, customerTaxId, memo, creditNotes, paymentAttempts, targetDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amountDue, autoCollection, billingAddress, createdAt, creditNotes, currency, customer, customerBalanceTransactions, customerTaxId, discount, discounts, dueDate, eligibleToIssueAt, hostedInvoiceUrl, invoiceNumber, invoicePdf, invoiceSource, issueFailedAt, issuedAt, lineItems, maximum, maximumAmount, memo, metadata, minimum, minimumAmount, paidAt, paymentAttempts, paymentFailedAt, paymentStartedAt, scheduledIssueAt, shippingAddress, status, subscription, subtotal, syncFailedAt, targetDate, total, voidedAt, willAutoIssue, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoiceFetchUpcomingResponse{metadata=$metadata, voidedAt=$voidedAt, paidAt=$paidAt, issuedAt=$issuedAt, scheduledIssueAt=$scheduledIssueAt, autoCollection=$autoCollection, issueFailedAt=$issueFailedAt, syncFailedAt=$syncFailedAt, paymentFailedAt=$paymentFailedAt, paymentStartedAt=$paymentStartedAt, amountDue=$amountDue, createdAt=$createdAt, currency=$currency, customer=$customer, discount=$discount, discounts=$discounts, dueDate=$dueDate, id=$id, invoicePdf=$invoicePdf, invoiceNumber=$invoiceNumber, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, lineItems=$lineItems, subscription=$subscription, subtotal=$subtotal, total=$total, customerBalanceTransactions=$customerBalanceTransactions, status=$status, invoiceSource=$invoiceSource, shippingAddress=$shippingAddress, billingAddress=$billingAddress, hostedInvoiceUrl=$hostedInvoiceUrl, willAutoIssue=$willAutoIssue, eligibleToIssueAt=$eligibleToIssueAt, customerTaxId=$customerTaxId, memo=$memo, creditNotes=$creditNotes, paymentAttempts=$paymentAttempts, targetDate=$targetDate, additionalProperties=$additionalProperties}" + "InvoiceFetchUpcomingResponse{id=$id, amountDue=$amountDue, autoCollection=$autoCollection, billingAddress=$billingAddress, createdAt=$createdAt, creditNotes=$creditNotes, currency=$currency, customer=$customer, customerBalanceTransactions=$customerBalanceTransactions, customerTaxId=$customerTaxId, discount=$discount, discounts=$discounts, dueDate=$dueDate, eligibleToIssueAt=$eligibleToIssueAt, hostedInvoiceUrl=$hostedInvoiceUrl, invoiceNumber=$invoiceNumber, invoicePdf=$invoicePdf, invoiceSource=$invoiceSource, issueFailedAt=$issueFailedAt, issuedAt=$issuedAt, lineItems=$lineItems, maximum=$maximum, maximumAmount=$maximumAmount, memo=$memo, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, paidAt=$paidAt, paymentAttempts=$paymentAttempts, paymentFailedAt=$paymentFailedAt, paymentStartedAt=$paymentStartedAt, scheduledIssueAt=$scheduledIssueAt, shippingAddress=$shippingAddress, status=$status, subscription=$subscription, subtotal=$subtotal, syncFailedAt=$syncFailedAt, targetDate=$targetDate, total=$total, voidedAt=$voidedAt, willAutoIssue=$willAutoIssue, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt index 2c5e080c..7d0e65cf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt @@ -100,7 +100,27 @@ constructor( * provider, a successful response from this endpoint guarantees the invoice is present * in the provider. */ - fun synchronous(synchronous: Boolean) = apply { this.synchronous = synchronous } + fun synchronous(synchronous: Boolean?) = apply { this.synchronous = synchronous } + + /** + * If true, the invoice will be issued synchronously. If false, the invoice will be + * issued asynchronously. The synchronous option is only available for invoices + * containin no usage fees. If the invoice is configured to sync to an external + * provider, a successful response from this endpoint guarantees the invoice is present + * in the provider. + */ + fun synchronous(synchronous: Boolean) = synchronous(synchronous as Boolean?) + + /** + * If true, the invoice will be issued synchronously. If false, the invoice will be + * issued asynchronously. The synchronous option is only available for invoices + * containin no usage fees. If the invoice is configured to sync to an external + * provider, a successful response from this endpoint guarantees the invoice is present + * in the provider. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun synchronous(synchronous: Optional) = + synchronous(synchronous.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -174,7 +194,25 @@ constructor( * fees. If the invoice is configured to sync to an external provider, a successful response * from this endpoint guarantees the invoice is present in the provider. */ - fun synchronous(synchronous: Boolean) = apply { body.synchronous(synchronous) } + fun synchronous(synchronous: Boolean?) = apply { body.synchronous(synchronous) } + + /** + * If true, the invoice will be issued synchronously. If false, the invoice will be issued + * asynchronously. The synchronous option is only available for invoices containin no usage + * fees. If the invoice is configured to sync to an external provider, a successful response + * from this endpoint guarantees the invoice is present in the provider. + */ + fun synchronous(synchronous: Boolean) = synchronous(synchronous as Boolean?) + + /** + * If true, the invoice will be issued synchronously. If false, the invoice will be issued + * asynchronously. The synchronous option is only available for invoices containin no usage + * fees. If the invoice is configured to sync to an external provider, a successful response + * from this endpoint guarantees the invoice is present in the provider. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun synchronous(synchronous: Optional) = + synchronous(synchronous.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/InvoiceLineItemCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt index a70dbb56..be7809ee 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt @@ -34,6 +34,7 @@ import kotlin.jvm.optionals.getOrNull class InvoiceLineItemCreateResponse @JsonCreator private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), @@ -46,39 +47,41 @@ private constructor( @JsonProperty("grouping") @ExcludeMissing private val grouping: JsonField = JsonMissing.of(), - @JsonProperty("minimum") - @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("minimum") + @ExcludeMissing + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("price") @ExcludeMissing private val price: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("subtotal") - @ExcludeMissing - private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("sub_line_items") @ExcludeMissing private val subLineItems: JsonField> = JsonMissing.of(), + @JsonProperty("subtotal") + @ExcludeMissing + private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("tax_amounts") @ExcludeMissing private val taxAmounts: JsonField> = JsonMissing.of(), - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("price") @ExcludeMissing private val price: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** A unique ID for this line item. */ + fun id(): String = id.getRequired("id") + /** The final amount after any discounts or minimums. */ fun amount(): String = amount.getRequired("amount") @@ -94,40 +97,18 @@ private constructor( */ fun grouping(): Optional = Optional.ofNullable(grouping.getNullable("grouping")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - /** The name of the price associated with this line item. */ - fun name(): String = name.getRequired("name") - - fun quantity(): Double = quantity.getRequired("quantity") - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** - * For complex pricing structures, the line item can be broken down further in `sub_line_items`. - */ - fun subLineItems(): List = subLineItems.getRequired("sub_line_items") + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - /** A unique ID for this line item. */ - fun id(): String = id.getRequired("id") + /** The name of the price associated with this line item. */ + fun name(): String = name.getRequired("name") /** * The Price resource represents a price that can be billed on a subscription, resulting in a @@ -359,6 +340,28 @@ private constructor( */ fun price(): Optional = Optional.ofNullable(price.getNullable("price")) + fun quantity(): Double = quantity.getRequired("quantity") + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + + /** + * For complex pricing structures, the line item can be broken down further in `sub_line_items`. + */ + fun subLineItems(): List = subLineItems.getRequired("sub_line_items") + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(): String = subtotal.getRequired("subtotal") + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(): List = taxAmounts.getRequired("tax_amounts") + + /** A unique ID for this line item. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The final amount after any discounts or minimums. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @@ -374,38 +377,16 @@ private constructor( */ @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum - - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - /** The name of the price associated with this line item. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - - @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - - /** The start date of the range of time applied for this line item's price. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The line amount before any line item-specific discounts or minimums. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal - - /** - * For complex pricing structures, the line item can be broken down further in `sub_line_items`. - */ - @JsonProperty("sub_line_items") @ExcludeMissing fun _subLineItems() = subLineItems + @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - @JsonProperty("tax_amounts") @ExcludeMissing fun _taxAmounts() = taxAmounts + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** A unique ID for this line item. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The name of the price associated with this line item. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name /** * The Price resource represents a price that can be billed on a subscription, resulting in a @@ -637,6 +618,25 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + + /** The start date of the range of time applied for this line item's price. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * For complex pricing structures, the line item can be broken down further in `sub_line_items`. + */ + @JsonProperty("sub_line_items") @ExcludeMissing fun _subLineItems() = subLineItems + + /** The line amount before any line item-specific discounts or minimums. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + @JsonProperty("tax_amounts") @ExcludeMissing fun _taxAmounts() = taxAmounts + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -645,22 +645,22 @@ private constructor( fun validate(): InvoiceLineItemCreateResponse = apply { if (!validated) { + id() amount() discount() endDate() grouping() - minimum().map { it.validate() } - minimumAmount() maximum().map { it.validate() } maximumAmount() + minimum().map { it.validate() } + minimumAmount() name() + price() quantity() startDate() - subtotal() subLineItems() + subtotal() taxAmounts().forEach { it.validate() } - id() - price() validated = true } } @@ -674,45 +674,51 @@ private constructor( class Builder { + private var id: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() private var grouping: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var subtotal: JsonField = JsonMissing.of() private var subLineItems: JsonField> = JsonMissing.of() + private var subtotal: JsonField = JsonMissing.of() private var taxAmounts: JsonField> = JsonMissing.of() - private var id: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceLineItemCreateResponse: InvoiceLineItemCreateResponse) = apply { + id = invoiceLineItemCreateResponse.id amount = invoiceLineItemCreateResponse.amount discount = invoiceLineItemCreateResponse.discount endDate = invoiceLineItemCreateResponse.endDate grouping = invoiceLineItemCreateResponse.grouping - minimum = invoiceLineItemCreateResponse.minimum - minimumAmount = invoiceLineItemCreateResponse.minimumAmount maximum = invoiceLineItemCreateResponse.maximum maximumAmount = invoiceLineItemCreateResponse.maximumAmount + minimum = invoiceLineItemCreateResponse.minimum + minimumAmount = invoiceLineItemCreateResponse.minimumAmount name = invoiceLineItemCreateResponse.name + price = invoiceLineItemCreateResponse.price quantity = invoiceLineItemCreateResponse.quantity startDate = invoiceLineItemCreateResponse.startDate - subtotal = invoiceLineItemCreateResponse.subtotal subLineItems = invoiceLineItemCreateResponse.subLineItems + subtotal = invoiceLineItemCreateResponse.subtotal taxAmounts = invoiceLineItemCreateResponse.taxAmounts - id = invoiceLineItemCreateResponse.id - price = invoiceLineItemCreateResponse.price additionalProperties = invoiceLineItemCreateResponse.additionalProperties.toMutableMap() } + /** A unique ID for this line item. */ + fun id(id: String) = id(JsonField.of(id)) + + /** A unique ID for this line item. */ + fun id(id: JsonField) = apply { this.id = id } + /** The final amount after any discounts or minimums. */ fun amount(amount: String) = amount(JsonField.of(amount)) @@ -743,16 +749,6 @@ private constructor( */ fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - - fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) fun maximum(maximum: JsonField) = apply { this.maximum = maximum } @@ -763,61 +759,21 @@ private constructor( this.maximumAmount = maximumAmount } - /** The name of the price associated with this line item. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price associated with this line item. */ - fun name(name: JsonField) = apply { this.name = name } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the range of time applied for this line item's price. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** The line amount before any line item-specific discounts or minimums. */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(subLineItems: List) = subLineItems(JsonField.of(subLineItems)) + fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - /** - * For complex pricing structures, the line item can be broken down further in - * `sub_line_items`. - */ - fun subLineItems(subLineItems: JsonField>) = apply { - this.subLineItems = subLineItems - } + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - fun taxAmounts(taxAmounts: List) = taxAmounts(JsonField.of(taxAmounts)) + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - /** - * An array of tax rates and their incurred tax amounts. Empty if no tax integration is - * configured. - */ - fun taxAmounts(taxAmounts: JsonField>) = apply { - this.taxAmounts = taxAmounts + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount } - /** A unique ID for this line item. */ - fun id(id: String) = id(JsonField.of(id)) + /** The name of the price associated with this line item. */ + fun name(name: String) = name(JsonField.of(name)) - /** A unique ID for this line item. */ - fun id(id: JsonField) = apply { this.id = id } + /** The name of the price associated with this line item. */ + fun name(name: JsonField) = apply { this.name = name } /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -1279,6 +1235,50 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the range of time applied for this line item's price. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(subLineItems: List) = subLineItems(JsonField.of(subLineItems)) + + /** + * For complex pricing structures, the line item can be broken down further in + * `sub_line_items`. + */ + fun subLineItems(subLineItems: JsonField>) = apply { + this.subLineItems = subLineItems + } + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** The line amount before any line item-specific discounts or minimums. */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(taxAmounts: List) = taxAmounts(JsonField.of(taxAmounts)) + + /** + * An array of tax rates and their incurred tax amounts. Empty if no tax integration is + * configured. + */ + fun taxAmounts(taxAmounts: JsonField>) = apply { + this.taxAmounts = taxAmounts + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1300,22 +1300,22 @@ private constructor( fun build(): InvoiceLineItemCreateResponse = InvoiceLineItemCreateResponse( + id, amount, discount, endDate, grouping, - minimum, - minimumAmount, maximum, maximumAmount, + minimum, + minimumAmount, name, + price, quantity, startDate, - subtotal, subLineItems.map { it.toImmutable() }, + subtotal, taxAmounts.map { it.toImmutable() }, - id, - price, additionalProperties.toImmutable(), ) } @@ -1324,19 +1324,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this * can be a subset of prices. @@ -1345,7 +1342,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this @@ -1355,6 +1352,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1363,8 +1363,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -1378,25 +1378,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -1412,6 +1404,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1433,8 +1433,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -1444,36 +1444,33 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } @NoAutoDetect class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this * can be a subset of prices. @@ -1482,7 +1479,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this @@ -1492,6 +1489,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1500,8 +1500,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -1515,25 +1515,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -1549,6 +1541,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1570,8 +1570,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -1581,17 +1581,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } @JsonDeserialize(using = SubLineItem.Deserializer::class) @@ -1754,21 +1754,21 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), + @JsonProperty("matrix_config") + @ExcludeMissing + private val matrixConfig: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") - @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("matrix_config") - @ExcludeMissing - private val matrixConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -1776,30 +1776,30 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + + fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) - fun type(): Type = type.getRequired("type") - fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") - /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + + @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1809,11 +1809,11 @@ private constructor( fun validate(): MatrixSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } + matrixConfig().validate() name() quantity() - grouping().map { it.validate() } type() - matrixConfig().validate() validated = true } } @@ -1828,21 +1828,21 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() + private var matrixConfig: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() - private var matrixConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixSubLineItem: MatrixSubLineItem) = apply { amount = matrixSubLineItem.amount + grouping = matrixSubLineItem.grouping + matrixConfig = matrixSubLineItem.matrixConfig name = matrixSubLineItem.name quantity = matrixSubLineItem.quantity - grouping = matrixSubLineItem.grouping type = matrixSubLineItem.type - matrixConfig = matrixSubLineItem.matrixConfig additionalProperties = matrixSubLineItem.additionalProperties.toMutableMap() } @@ -1852,6 +1852,17 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + + fun matrixConfig(matrixConfig: MatrixConfig) = + matrixConfig(JsonField.of(matrixConfig)) + + fun matrixConfig(matrixConfig: JsonField) = apply { + this.matrixConfig = matrixConfig + } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -1860,21 +1871,10 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } - fun matrixConfig(matrixConfig: MatrixConfig) = - matrixConfig(JsonField.of(matrixConfig)) - - fun matrixConfig(matrixConfig: JsonField) = apply { - this.matrixConfig = matrixConfig - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1900,11 +1900,11 @@ private constructor( fun build(): MatrixSubLineItem = MatrixSubLineItem( amount, + grouping, + matrixConfig, name, quantity, - grouping, type, - matrixConfig, additionalProperties.toImmutable(), ) } @@ -2188,17 +2188,17 @@ private constructor( return true } - return /* spotless:off */ other is MatrixSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && matrixConfig == other.matrixConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixSubLineItem && amount == other.amount && grouping == other.grouping && matrixConfig == other.matrixConfig && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, matrixConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, matrixConfig, name, quantity, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, matrixConfig=$matrixConfig, additionalProperties=$additionalProperties}" + "MatrixSubLineItem{amount=$amount, grouping=$grouping, matrixConfig=$matrixConfig, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2208,21 +2208,21 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") + @JsonProperty("tier_config") @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), + private val tierConfig: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonProperty("tier_config") - @ExcludeMissing - private val tierConfig: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -2230,30 +2230,30 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) + fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") fun type(): Type = type.getRequired("type") - fun tierConfig(): TierConfig = tierConfig.getRequired("tier_config") - /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("tier_config") @ExcludeMissing fun _tierConfig() = tierConfig @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("tier_config") @ExcludeMissing fun _tierConfig() = tierConfig - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2263,11 +2263,11 @@ private constructor( fun validate(): TierSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } name() quantity() - grouping().map { it.validate() } - type() tierConfig().validate() + type() validated = true } } @@ -2282,21 +2282,21 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() private var tierConfig: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tierSubLineItem: TierSubLineItem) = apply { amount = tierSubLineItem.amount + grouping = tierSubLineItem.grouping name = tierSubLineItem.name quantity = tierSubLineItem.quantity - grouping = tierSubLineItem.grouping - type = tierSubLineItem.type tierConfig = tierSubLineItem.tierConfig + type = tierSubLineItem.type additionalProperties = tierSubLineItem.additionalProperties.toMutableMap() } @@ -2306,6 +2306,10 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -2314,20 +2318,16 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - - fun type(type: Type) = type(JsonField.of(type)) - - fun type(type: JsonField) = apply { this.type = type } - fun tierConfig(tierConfig: TierConfig) = tierConfig(JsonField.of(tierConfig)) fun tierConfig(tierConfig: JsonField) = apply { this.tierConfig = tierConfig } + fun type(type: Type) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2353,11 +2353,11 @@ private constructor( fun build(): TierSubLineItem = TierSubLineItem( amount, + grouping, name, quantity, - grouping, - type, tierConfig, + type, additionalProperties.toImmutable(), ) } @@ -2666,17 +2666,17 @@ private constructor( return true } - return /* spotless:off */ other is TierSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && tierConfig == other.tierConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TierSubLineItem && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && tierConfig == other.tierConfig && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, tierConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, name, quantity, tierConfig, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TierSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, tierConfig=$tierConfig, additionalProperties=$additionalProperties}" + "TierSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, tierConfig=$tierConfig, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2686,15 +2686,15 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("grouping") + @ExcludeMissing + private val grouping: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("grouping") - @ExcludeMissing - private val grouping: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @@ -2705,24 +2705,24 @@ private constructor( /** The total amount for this sub line item. */ fun amount(): String = amount.getRequired("amount") + fun grouping(): Optional = + Optional.ofNullable(grouping.getNullable("grouping")) + fun name(): String = name.getRequired("name") fun quantity(): Double = quantity.getRequired("quantity") - fun grouping(): Optional = - Optional.ofNullable(grouping.getNullable("grouping")) - fun type(): Type = type.getRequired("type") /** The total amount for this sub line item. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount + @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - @JsonProperty("grouping") @ExcludeMissing fun _grouping() = grouping - @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @@ -2734,9 +2734,9 @@ private constructor( fun validate(): OtherSubLineItem = apply { if (!validated) { amount() + grouping().map { it.validate() } name() quantity() - grouping().map { it.validate() } type() validated = true } @@ -2752,18 +2752,18 @@ private constructor( class Builder { private var amount: JsonField = JsonMissing.of() + private var grouping: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() - private var grouping: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(otherSubLineItem: OtherSubLineItem) = apply { amount = otherSubLineItem.amount + grouping = otherSubLineItem.grouping name = otherSubLineItem.name quantity = otherSubLineItem.quantity - grouping = otherSubLineItem.grouping type = otherSubLineItem.type additionalProperties = otherSubLineItem.additionalProperties.toMutableMap() } @@ -2774,6 +2774,10 @@ private constructor( /** The total amount for this sub line item. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) + + fun grouping(grouping: JsonField) = apply { this.grouping = grouping } + fun name(name: String) = name(JsonField.of(name)) fun name(name: JsonField) = apply { this.name = name } @@ -2782,10 +2786,6 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun grouping(grouping: Grouping) = grouping(JsonField.of(grouping)) - - fun grouping(grouping: JsonField) = apply { this.grouping = grouping } - fun type(type: Type) = type(JsonField.of(type)) fun type(type: JsonField) = apply { this.type = type } @@ -2815,9 +2815,9 @@ private constructor( fun build(): OtherSubLineItem = OtherSubLineItem( amount, + grouping, name, quantity, - grouping, type, additionalProperties.toImmutable(), ) @@ -2995,17 +2995,17 @@ private constructor( return true } - return /* spotless:off */ other is OtherSubLineItem && amount == other.amount && name == other.name && quantity == other.quantity && grouping == other.grouping && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is OtherSubLineItem && amount == other.amount && grouping == other.grouping && name == other.name && quantity == other.quantity && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, name, quantity, grouping, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, grouping, name, quantity, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "OtherSubLineItem{amount=$amount, name=$name, quantity=$quantity, grouping=$grouping, type=$type, additionalProperties=$additionalProperties}" + "OtherSubLineItem{amount=$amount, grouping=$grouping, name=$name, quantity=$quantity, type=$type, additionalProperties=$additionalProperties}" } } @@ -3013,19 +3013,22 @@ private constructor( class TaxAmount @JsonCreator private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_description") @ExcludeMissing private val taxRateDescription: JsonField = JsonMissing.of(), @JsonProperty("tax_rate_percentage") @ExcludeMissing private val taxRatePercentage: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** The amount of additional tax incurred by this tax rate. */ + fun amount(): String = amount.getRequired("amount") + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(): String = taxRateDescription.getRequired("tax_rate_description") @@ -3034,7 +3037,7 @@ private constructor( Optional.ofNullable(taxRatePercentage.getNullable("tax_rate_percentage")) /** The amount of additional tax incurred by this tax rate. */ - fun amount(): String = amount.getRequired("amount") + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** The human-readable description of the applied tax rate. */ @JsonProperty("tax_rate_description") @@ -3046,9 +3049,6 @@ private constructor( @ExcludeMissing fun _taxRatePercentage() = taxRatePercentage - /** The amount of additional tax incurred by this tax rate. */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3057,9 +3057,9 @@ private constructor( fun validate(): TaxAmount = apply { if (!validated) { + amount() taxRateDescription() taxRatePercentage() - amount() validated = true } } @@ -3073,19 +3073,25 @@ private constructor( class Builder { + private var amount: JsonField = JsonMissing.of() private var taxRateDescription: JsonField = JsonMissing.of() private var taxRatePercentage: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(taxAmount: TaxAmount) = apply { + amount = taxAmount.amount taxRateDescription = taxAmount.taxRateDescription taxRatePercentage = taxAmount.taxRatePercentage - amount = taxAmount.amount additionalProperties = taxAmount.additionalProperties.toMutableMap() } + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: String) = amount(JsonField.of(amount)) + + /** The amount of additional tax incurred by this tax rate. */ + fun amount(amount: JsonField) = apply { this.amount = amount } + /** The human-readable description of the applied tax rate. */ fun taxRateDescription(taxRateDescription: String) = taxRateDescription(JsonField.of(taxRateDescription)) @@ -3104,12 +3110,6 @@ private constructor( this.taxRatePercentage = taxRatePercentage } - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: String) = amount(JsonField.of(amount)) - - /** The amount of additional tax incurred by this tax rate. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3131,9 +3131,9 @@ private constructor( fun build(): TaxAmount = TaxAmount( + amount, taxRateDescription, taxRatePercentage, - amount, additionalProperties.toImmutable(), ) } @@ -3143,17 +3143,17 @@ private constructor( return true } - return /* spotless:off */ other is TaxAmount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TaxAmount && amount == other.amount && taxRateDescription == other.taxRateDescription && taxRatePercentage == other.taxRatePercentage && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(taxRateDescription, taxRatePercentage, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, taxRateDescription, taxRatePercentage, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TaxAmount{taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, amount=$amount, additionalProperties=$additionalProperties}" + "TaxAmount{amount=$amount, taxRateDescription=$taxRateDescription, taxRatePercentage=$taxRatePercentage, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3161,15 +3161,15 @@ private constructor( return true } - return /* spotless:off */ other is InvoiceLineItemCreateResponse && amount == other.amount && discount == other.discount && endDate == other.endDate && grouping == other.grouping && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && name == other.name && quantity == other.quantity && startDate == other.startDate && subtotal == other.subtotal && subLineItems == other.subLineItems && taxAmounts == other.taxAmounts && id == other.id && price == other.price && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceLineItemCreateResponse && id == other.id && amount == other.amount && discount == other.discount && endDate == other.endDate && grouping == other.grouping && maximum == other.maximum && maximumAmount == other.maximumAmount && minimum == other.minimum && minimumAmount == other.minimumAmount && name == other.name && price == other.price && quantity == other.quantity && startDate == other.startDate && subLineItems == other.subLineItems && subtotal == other.subtotal && taxAmounts == other.taxAmounts && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, discount, endDate, grouping, minimum, minimumAmount, maximum, maximumAmount, name, quantity, startDate, subtotal, subLineItems, taxAmounts, id, price, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, discount, endDate, grouping, maximum, maximumAmount, minimum, minimumAmount, name, price, quantity, startDate, subLineItems, subtotal, taxAmounts, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoiceLineItemCreateResponse{amount=$amount, discount=$discount, endDate=$endDate, grouping=$grouping, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, name=$name, quantity=$quantity, startDate=$startDate, subtotal=$subtotal, subLineItems=$subLineItems, taxAmounts=$taxAmounts, id=$id, price=$price, additionalProperties=$additionalProperties}" + "InvoiceLineItemCreateResponse{id=$id, amount=$amount, discount=$discount, endDate=$endDate, grouping=$grouping, maximum=$maximum, maximumAmount=$maximumAmount, minimum=$minimum, minimumAmount=$minimumAmount, name=$name, price=$price, quantity=$quantity, startDate=$startDate, subLineItems=$subLineItems, subtotal=$subtotal, taxAmounts=$taxAmounts, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt index 3bf0418b..225b2d57 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt @@ -200,67 +200,130 @@ constructor( additionalQueryParams = invoiceListParams.additionalQueryParams.toBuilder() } - fun amount(amount: String) = apply { this.amount = amount } + fun amount(amount: String?) = apply { this.amount = amount } - fun amountGt(amountGt: String) = apply { this.amountGt = amountGt } + fun amount(amount: Optional) = amount(amount.orElse(null)) - fun amountLt(amountLt: String) = apply { this.amountLt = amountLt } + fun amountGt(amountGt: String?) = apply { this.amountGt = amountGt } + + fun amountGt(amountGt: Optional) = amountGt(amountGt.orElse(null)) + + fun amountLt(amountLt: String?) = apply { this.amountLt = amountLt } + + fun amountLt(amountLt: Optional) = amountLt(amountLt.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)) - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } - fun dateType(dateType: DateType) = apply { this.dateType = dateType } + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) - fun dueDate(dueDate: LocalDate) = apply { this.dueDate = dueDate } + fun dateType(dateType: DateType?) = apply { this.dateType = dateType } + + fun dateType(dateType: Optional) = dateType(dateType.orElse(null)) + + fun dueDate(dueDate: LocalDate?) = apply { this.dueDate = dueDate } + + fun dueDate(dueDate: Optional) = dueDate(dueDate.orElse(null)) + + /** + * Filters invoices by their due dates within a specific time range in the past. Specify the + * range as a number followed by 'd' (days) or 'm' (months). For example, '7d' filters + * invoices due in the last 7 days, and '2m' filters those due in the last 2 months. + */ + fun dueDateWindow(dueDateWindow: String?) = apply { this.dueDateWindow = dueDateWindow } /** * Filters invoices by their due dates within a specific time range in the past. Specify the * range as a number followed by 'd' (days) or 'm' (months). For example, '7d' filters * invoices due in the last 7 days, and '2m' filters those due in the last 2 months. */ - fun dueDateWindow(dueDateWindow: String) = apply { this.dueDateWindow = dueDateWindow } + fun dueDateWindow(dueDateWindow: Optional) = + dueDateWindow(dueDateWindow.orElse(null)) + + fun dueDateGt(dueDateGt: LocalDate?) = apply { this.dueDateGt = dueDateGt } - fun dueDateGt(dueDateGt: LocalDate) = apply { this.dueDateGt = dueDateGt } + fun dueDateGt(dueDateGt: Optional) = dueDateGt(dueDateGt.orElse(null)) - fun dueDateLt(dueDateLt: LocalDate) = apply { this.dueDateLt = dueDateLt } + fun dueDateLt(dueDateLt: LocalDate?) = apply { this.dueDateLt = dueDateLt } - fun externalCustomerId(externalCustomerId: String) = apply { + fun dueDateLt(dueDateLt: Optional) = dueDateLt(dueDateLt.orElse(null)) + + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } - fun invoiceDateGt(invoiceDateGt: OffsetDateTime) = apply { + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + fun invoiceDateGt(invoiceDateGt: OffsetDateTime?) = apply { this.invoiceDateGt = invoiceDateGt } - fun invoiceDateGte(invoiceDateGte: OffsetDateTime) = apply { + fun invoiceDateGt(invoiceDateGt: Optional) = + invoiceDateGt(invoiceDateGt.orElse(null)) + + fun invoiceDateGte(invoiceDateGte: OffsetDateTime?) = apply { this.invoiceDateGte = invoiceDateGte } - fun invoiceDateLt(invoiceDateLt: OffsetDateTime) = apply { + fun invoiceDateGte(invoiceDateGte: Optional) = + invoiceDateGte(invoiceDateGte.orElse(null)) + + fun invoiceDateLt(invoiceDateLt: OffsetDateTime?) = apply { this.invoiceDateLt = invoiceDateLt } - fun invoiceDateLte(invoiceDateLte: OffsetDateTime) = apply { + fun invoiceDateLt(invoiceDateLt: Optional) = + invoiceDateLt(invoiceDateLt.orElse(null)) + + fun invoiceDateLte(invoiceDateLte: OffsetDateTime?) = apply { this.invoiceDateLte = invoiceDateLte } - fun isRecurring(isRecurring: Boolean) = apply { this.isRecurring = isRecurring } + fun invoiceDateLte(invoiceDateLte: Optional) = + invoiceDateLte(invoiceDateLte.orElse(null)) + + fun isRecurring(isRecurring: Boolean?) = apply { this.isRecurring = isRecurring } + + fun isRecurring(isRecurring: Boolean) = isRecurring(isRecurring as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isRecurring(isRecurring: Optional) = + isRecurring(isRecurring.orElse(null) as Boolean?) + + /** 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?) - fun status(status: List) = apply { this.status = status.toMutableList() } + /** 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 status(status: List?) = apply { this.status = status?.toMutableList() } + + fun status(status: Optional>) = status(status.orElse(null)) fun addStatus(status: Status) = apply { this.status = (this.status ?: mutableListOf()).apply { add(status) } } - fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + 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/InvoiceMarkPaidParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt index 47dbe840..1b693eaa 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt @@ -109,10 +109,16 @@ constructor( } /** An optional external ID to associate with the payment. */ - fun externalId(externalId: String) = apply { this.externalId = externalId } + fun externalId(externalId: String?) = apply { this.externalId = externalId } + + /** An optional external ID to associate with the payment. */ + fun externalId(externalId: Optional) = externalId(externalId.orElse(null)) + + /** An optional note to associate with the payment. */ + fun notes(notes: String?) = apply { this.notes = notes } /** An optional note to associate with the payment. */ - fun notes(notes: String) = apply { this.notes = notes } + fun notes(notes: Optional) = notes(notes.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -193,10 +199,16 @@ constructor( } /** An optional external ID to associate with the payment. */ - fun externalId(externalId: String) = apply { body.externalId(externalId) } + fun externalId(externalId: String?) = apply { body.externalId(externalId) } + + /** An optional external ID to associate with the payment. */ + fun externalId(externalId: Optional) = externalId(externalId.orElse(null)) + + /** An optional note to associate with the payment. */ + fun notes(notes: String?) = apply { body.notes(notes) } /** An optional note to associate with the payment. */ - fun notes(notes: String) = apply { body.notes(notes) } + fun notes(notes: Optional) = notes(notes.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt index e7f6fade..a927fda1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt @@ -95,7 +95,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -168,7 +175,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt index 854466a3..48281b09 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt @@ -28,28 +28,26 @@ class Item @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), @JsonProperty("external_connections") @ExcludeMissing private val externalConnections: JsonField> = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - fun name(): String = name.getRequired("name") - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun externalConnections(): List = externalConnections.getRequired("external_connections") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun name(): String = name.getRequired("name") - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt @@ -57,6 +55,8 @@ private constructor( @ExcludeMissing fun _externalConnections() = externalConnections + @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -66,9 +66,9 @@ private constructor( fun validate(): Item = apply { if (!validated) { id() - name() createdAt() externalConnections().forEach { it.validate() } + name() validated = true } } @@ -83,17 +83,17 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() private var externalConnections: JsonField> = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(item: Item) = apply { id = item.id - name = item.name createdAt = item.createdAt externalConnections = item.externalConnections + name = item.name additionalProperties = item.additionalProperties.toMutableMap() } @@ -101,10 +101,6 @@ private constructor( 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 createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } @@ -116,6 +112,10 @@ private constructor( this.externalConnections = externalConnections } + fun name(name: String) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -138,9 +138,9 @@ private constructor( fun build(): Item = Item( id, - name, createdAt, externalConnections.map { it.toImmutable() }, + name, additionalProperties.toImmutable(), ) } @@ -358,15 +358,15 @@ private constructor( return true } - return /* spotless:off */ other is Item && id == other.id && name == other.name && createdAt == other.createdAt && externalConnections == other.externalConnections && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Item && id == other.id && createdAt == other.createdAt && externalConnections == other.externalConnections && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, createdAt, externalConnections, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, createdAt, externalConnections, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Item{id=$id, name=$name, createdAt=$createdAt, externalConnections=$externalConnections, additionalProperties=$additionalProperties}" + "Item{id=$id, createdAt=$createdAt, externalConnections=$externalConnections, name=$name, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt index d4d790fb..a465ffc9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt @@ -67,10 +67,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/ItemUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt index adc508bd..d6ed6032 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt @@ -98,16 +98,21 @@ constructor( additionalProperties = itemUpdateBody.additionalProperties.toMutableMap() } - fun externalConnections(externalConnections: List) = apply { - this.externalConnections = externalConnections.toMutableList() + fun externalConnections(externalConnections: List?) = apply { + this.externalConnections = externalConnections?.toMutableList() } + fun externalConnections(externalConnections: Optional>) = + externalConnections(externalConnections.orElse(null)) + fun addExternalConnection(externalConnection: ExternalConnection) = apply { externalConnections = (externalConnections ?: mutableListOf()).apply { add(externalConnection) } } - fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + fun name(name: Optional) = name(name.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -179,15 +184,20 @@ constructor( fun itemId(itemId: String) = apply { this.itemId = itemId } - fun externalConnections(externalConnections: List) = apply { + fun externalConnections(externalConnections: List?) = apply { body.externalConnections(externalConnections) } + fun externalConnections(externalConnections: Optional>) = + externalConnections(externalConnections.orElse(null)) + fun addExternalConnection(externalConnection: ExternalConnection) = apply { body.addExternalConnection(externalConnection) } - fun name(name: String) = apply { body.name(name) } + fun name(name: String?) = apply { body.name(name) } + + fun name(name: Optional) = name(name.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt index 3333fe01..967cbe45 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt @@ -118,7 +118,10 @@ constructor( } /** A description of the metric. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } + + /** A description of the metric. */ + fun description(description: Optional) = description(description.orElse(null)) /** The id of the item */ fun itemId(itemId: String) = apply { this.itemId = itemId } @@ -134,7 +137,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -206,7 +216,10 @@ constructor( } /** A description of the metric. */ - fun description(description: String) = apply { body.description(description) } + fun description(description: String?) = apply { body.description(description) } + + /** A description of the metric. */ + fun description(description: Optional) = description(description.orElse(null)) /** The id of the item */ fun itemId(itemId: String) = apply { body.itemId(itemId) } @@ -222,7 +235,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt index bc2c7c63..d2e12d65 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt @@ -109,22 +109,47 @@ constructor( additionalQueryParams = metricListParams.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 } + 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/MetricUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt index 122ec16a..2cd90ec6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt @@ -95,7 +95,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -168,7 +175,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt index 9afe71de..42970b62 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt @@ -22,35 +22,33 @@ import java.util.Optional class PercentageDiscount @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("discount_type") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a * subset of prices. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + fun discountType(): DiscountType = discountType.getRequired("discount_type") /** Only available if discount_type is `percentage`. This is a number between 0 and 1. */ fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a @@ -60,13 +58,15 @@ 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 `percentage`. This is a number between 0 and 1. */ @JsonProperty("percentage_discount") @ExcludeMissing fun _percentageDiscount() = percentageDiscount + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -75,10 +75,10 @@ private constructor( fun validate(): PercentageDiscount = apply { if (!validated) { - discountType() appliesToPriceIds() - reason() + discountType() percentageDiscount() + reason() validated = true } } @@ -92,27 +92,21 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var reason: JsonField = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() + private var reason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscount: PercentageDiscount) = apply { - discountType = percentageDiscount.discountType appliesToPriceIds = percentageDiscount.appliesToPriceIds - reason = percentageDiscount.reason + discountType = percentageDiscount.discountType this.percentageDiscount = percentageDiscount.percentageDiscount + reason = percentageDiscount.reason additionalProperties = percentageDiscount.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can * be a subset of prices. @@ -128,9 +122,11 @@ 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 `percentage`. This is a number between 0 and 1. */ fun percentageDiscount(percentageDiscount: Double) = @@ -141,6 +137,10 @@ private constructor( this.percentageDiscount = percentageDiscount } + fun reason(reason: String) = reason(JsonField.of(reason)) + + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -162,10 +162,10 @@ private constructor( fun build(): PercentageDiscount = PercentageDiscount( - discountType, appliesToPriceIds.map { it.toImmutable() }, - reason, + discountType, percentageDiscount, + reason, additionalProperties.toImmutable(), ) } @@ -226,15 +226,15 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscount && discountType == other.discountType && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscount && appliesToPriceIds == other.appliesToPriceIds && discountType == other.discountType && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, appliesToPriceIds, reason, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, discountType, percentageDiscount, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscount{discountType=$discountType, appliesToPriceIds=$appliesToPriceIds, reason=$reason, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscount{appliesToPriceIds=$appliesToPriceIds, discountType=$discountType, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt index 42ea58a9..d64e13ea 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt @@ -39,123 +39,109 @@ import kotlin.jvm.optionals.getOrNull class Plan @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") + @JsonProperty("adjustments") @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val adjustments: JsonField> = JsonMissing.of(), + @JsonProperty("base_plan") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") + private val basePlan: JsonField = JsonMissing.of(), + @JsonProperty("base_plan_id") @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), + private val basePlanId: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("status") + @JsonProperty("currency") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("minimum") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("description") @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), + private val description: JsonField = JsonMissing.of(), @JsonProperty("discount") @ExcludeMissing private val discount: JsonField = JsonMissing.of(), - @JsonProperty("product") - @ExcludeMissing - private val product: JsonField = JsonMissing.of(), - @JsonProperty("version") - @ExcludeMissing - private val version: JsonField = JsonMissing.of(), - @JsonProperty("trial_config") + @JsonProperty("external_plan_id") @ExcludeMissing - private val trialConfig: JsonField = JsonMissing.of(), - @JsonProperty("plan_phases") + private val externalPlanId: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_currency") @ExcludeMissing - private val planPhases: JsonField> = JsonMissing.of(), - @JsonProperty("base_plan") + private val invoicingCurrency: JsonField = JsonMissing.of(), + @JsonProperty("maximum") @ExcludeMissing - private val basePlan: JsonField = JsonMissing.of(), - @JsonProperty("base_plan_id") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val basePlanId: JsonField = JsonMissing.of(), - @JsonProperty("external_plan_id") + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val externalPlanId: JsonField = JsonMissing.of(), - @JsonProperty("currency") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_currency") + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") @ExcludeMissing - private val invoicingCurrency: JsonField = JsonMissing.of(), + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @JsonProperty("net_terms") @ExcludeMissing private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("default_invoice_memo") + @JsonProperty("plan_phases") @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + private val planPhases: JsonField> = JsonMissing.of(), @JsonProperty("prices") @ExcludeMissing private val prices: JsonField> = JsonMissing.of(), - @JsonProperty("adjustments") + @JsonProperty("product") @ExcludeMissing - private val adjustments: JsonField> = JsonMissing.of(), + private val product: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_config") + @ExcludeMissing + private val trialConfig: JsonField = JsonMissing.of(), + @JsonProperty("version") + @ExcludeMissing + private val version: 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(): String = description.getRequired("description") + /** + * Adjustments for this plan. If the plan has phases, this includes adjustments across all + * phases of the plan. + */ + fun adjustments(): List = adjustments.getRequired("adjustments") - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + fun basePlan(): Optional = Optional.ofNullable(basePlan.getNullable("base_plan")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + /** + * The parent plan id if the given plan was created by overriding one or more of the parent's + * prices + */ + fun basePlanId(): Optional = Optional.ofNullable(basePlanId.getNullable("base_plan_id")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun status(): Status = status.getRequired("status") + /** An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. */ + fun currency(): String = currency.getRequired("currency") - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) + /** + * The default memo text on the invoices corresponding to subscriptions on this plan. Note that + * each subscription may configure its own memo. + */ + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun description(): String = description.getRequired("description") fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun product(): Product = product.getRequired("product") - - fun version(): Long = version.getRequired("version") - - fun trialConfig(): TrialConfig = trialConfig.getRequired("trial_config") - - fun planPhases(): Optional> = - Optional.ofNullable(planPhases.getNullable("plan_phases")) - - fun basePlan(): Optional = Optional.ofNullable(basePlan.getNullable("base_plan")) - - /** - * The parent plan id if the given plan was created by overriding one or more of the parent's - * prices - */ - fun basePlanId(): Optional = Optional.ofNullable(basePlanId.getNullable("base_plan_id")) - /** * An optional user-defined ID for this plan resource, used throughout the system as an alias * for this Plan. Use this field to identify a plan by an existing identifier in your system. @@ -163,15 +149,31 @@ private constructor( fun externalPlanId(): Optional = Optional.ofNullable(externalPlanId.getNullable("external_plan_id")) - /** An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. */ - fun currency(): String = currency.getRequired("currency") - /** * An ISO 4217 currency string for which this plan is billed in. Matches `currency` unless * `currency` is a custom pricing unit. */ fun invoicingCurrency(): String = invoicingCurrency.getRequired("invoicing_currency") + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) + + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + /** + * 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 minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + fun name(): String = name.getRequired("name") + /** * Determines the difference between the invoice issue date and the due date. A value of "0" * here signifies that invoices are due on issue, whereas a value of "30" means that the @@ -180,12 +182,8 @@ private constructor( */ fun netTerms(): Optional = Optional.ofNullable(netTerms.getNullable("net_terms")) - /** - * The default memo text on the invoices corresponding to subscriptions on this plan. Note that - * each subscription may configure its own memo. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + fun planPhases(): Optional> = + Optional.ofNullable(planPhases.getNullable("plan_phases")) /** * Prices for this plan. If the plan has phases, this includes prices across all phases of the @@ -193,70 +191,76 @@ private constructor( */ fun prices(): List = prices.getRequired("prices") + fun product(): Product = product.getRequired("product") + + fun status(): Status = status.getRequired("status") + + fun trialConfig(): TrialConfig = trialConfig.getRequired("trial_config") + + fun version(): Long = version.getRequired("version") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + /** * Adjustments for this plan. If the plan has phases, this includes adjustments across all * phases of the plan. */ - fun adjustments(): List = adjustments.getRequired("adjustments") + @JsonProperty("adjustments") @ExcludeMissing fun _adjustments() = adjustments + + @JsonProperty("base_plan") @ExcludeMissing fun _basePlan() = basePlan /** - * 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`. + * The parent plan id if the given plan was created by overriding one or more of the parent's + * prices */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id - - @JsonProperty("name") @ExcludeMissing fun _name() = name - - @JsonProperty("description") @ExcludeMissing fun _description() = description - - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonProperty("base_plan_id") @ExcludeMissing fun _basePlanId() = basePlanId @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("status") @ExcludeMissing fun _status() = status + /** An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. */ + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + /** + * The default memo text on the invoices corresponding to subscriptions on this plan. Note that + * each subscription may configure its own memo. + */ + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum + @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("discount") @ExcludeMissing fun _discount() = discount - @JsonProperty("product") @ExcludeMissing fun _product() = product - - @JsonProperty("version") @ExcludeMissing fun _version() = version - - @JsonProperty("trial_config") @ExcludeMissing fun _trialConfig() = trialConfig - - @JsonProperty("plan_phases") @ExcludeMissing fun _planPhases() = planPhases - - @JsonProperty("base_plan") @ExcludeMissing fun _basePlan() = basePlan - - /** - * The parent plan id if the given plan was created by overriding one or more of the parent's - * prices - */ - @JsonProperty("base_plan_id") @ExcludeMissing fun _basePlanId() = basePlanId - /** * An optional user-defined ID for this plan resource, used throughout the system as an alias * for this Plan. Use this field to identify a plan by an existing identifier in your system. */ @JsonProperty("external_plan_id") @ExcludeMissing fun _externalPlanId() = externalPlanId - /** An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. */ - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - /** * An ISO 4217 currency string for which this plan is billed in. Matches `currency` unless * `currency` is a custom pricing unit. */ @JsonProperty("invoicing_currency") @ExcludeMissing fun _invoicingCurrency() = invoicingCurrency + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum + + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + + @JsonProperty("name") @ExcludeMissing fun _name() = name + /** * Determines the difference between the invoice issue date and the due date. A value of "0" * here signifies that invoices are due on issue, whereas a value of "30" means that the @@ -265,13 +269,7 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - /** - * The default memo text on the invoices corresponding to subscriptions on this plan. Note that - * each subscription may configure its own memo. - */ - @JsonProperty("default_invoice_memo") - @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + @JsonProperty("plan_phases") @ExcludeMissing fun _planPhases() = planPhases /** * Prices for this plan. If the plan has phases, this includes prices across all phases of the @@ -279,11 +277,13 @@ private constructor( */ @JsonProperty("prices") @ExcludeMissing fun _prices() = prices - /** - * Adjustments for this plan. If the plan has phases, this includes adjustments across all - * phases of the plan. - */ - @JsonProperty("adjustments") @ExcludeMissing fun _adjustments() = adjustments + @JsonProperty("product") @ExcludeMissing fun _product() = product + + @JsonProperty("status") @ExcludeMissing fun _status() = status + + @JsonProperty("trial_config") @ExcludeMissing fun _trialConfig() = trialConfig + + @JsonProperty("version") @ExcludeMissing fun _version() = version @JsonAnyGetter @ExcludeMissing @@ -293,30 +293,30 @@ private constructor( fun validate(): Plan = apply { if (!validated) { - metadata().validate() id() - name() - description() - maximumAmount() - minimumAmount() - createdAt() - status() - maximum().map { it.validate() } - minimum().map { it.validate() } - discount() - product().validate() - version() - trialConfig().validate() - planPhases().map { it.forEach { it.validate() } } + adjustments() basePlan().map { it.validate() } basePlanId() - externalPlanId() + createdAt() currency() + defaultInvoiceMemo() + description() + discount() + externalPlanId() invoicingCurrency() + maximum().map { it.validate() } + maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + name() netTerms() - defaultInvoiceMemo() + planPhases().map { it.forEach { it.validate() } } prices() - adjustments() + product().validate() + status() + trialConfig().validate() + version() validated = true } } @@ -330,155 +330,132 @@ 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 maximumAmount: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var maximum: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var discount: JsonField = JsonMissing.of() - private var product: JsonField = JsonMissing.of() - private var version: JsonField = JsonMissing.of() - private var trialConfig: JsonField = JsonMissing.of() - private var planPhases: JsonField> = JsonMissing.of() + private var adjustments: JsonField> = JsonMissing.of() private var basePlan: JsonField = JsonMissing.of() private var basePlanId: JsonField = JsonMissing.of() - private var externalPlanId: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var discount: JsonField = JsonMissing.of() + private var externalPlanId: JsonField = JsonMissing.of() private var invoicingCurrency: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var netTerms: JsonField = JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var planPhases: JsonField> = JsonMissing.of() private var prices: JsonField> = JsonMissing.of() - private var adjustments: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(plan: Plan) = apply { - metadata = plan.metadata - id = plan.id - name = plan.name - description = plan.description - maximumAmount = plan.maximumAmount - minimumAmount = plan.minimumAmount - createdAt = plan.createdAt - status = plan.status - maximum = plan.maximum - minimum = plan.minimum - discount = plan.discount - product = plan.product - version = plan.version - trialConfig = plan.trialConfig - planPhases = plan.planPhases + private var product: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialConfig: JsonField = JsonMissing.of() + private var version: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(plan: Plan) = apply { + id = plan.id + adjustments = plan.adjustments basePlan = plan.basePlan basePlanId = plan.basePlanId - externalPlanId = plan.externalPlanId + createdAt = plan.createdAt currency = plan.currency + defaultInvoiceMemo = plan.defaultInvoiceMemo + description = plan.description + discount = plan.discount + externalPlanId = plan.externalPlanId invoicingCurrency = plan.invoicingCurrency + maximum = plan.maximum + maximumAmount = plan.maximumAmount + metadata = plan.metadata + minimum = plan.minimum + minimumAmount = plan.minimumAmount + name = plan.name netTerms = plan.netTerms - defaultInvoiceMemo = plan.defaultInvoiceMemo + planPhases = plan.planPhases prices = plan.prices - adjustments = plan.adjustments + product = plan.product + status = plan.status + trialConfig = plan.trialConfig + version = plan.version additionalProperties = plan.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)) + /** + * Adjustments for this plan. If the plan has phases, this includes adjustments across all + * phases of the plan. + */ + fun adjustments(adjustments: List) = adjustments(JsonField.of(adjustments)) - fun description(description: JsonField) = apply { this.description = description } + /** + * Adjustments for this plan. If the plan has phases, this includes adjustments across all + * phases of the plan. + */ + fun adjustments(adjustments: JsonField>) = apply { + this.adjustments = adjustments + } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun basePlan(basePlan: BasePlan) = basePlan(JsonField.of(basePlan)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + fun basePlan(basePlan: JsonField) = apply { this.basePlan = basePlan } - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + /** + * The parent plan id if the given plan was created by overriding one or more of the + * parent's prices + */ + fun basePlanId(basePlanId: String) = basePlanId(JsonField.of(basePlanId)) - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } + /** + * The parent plan id if the given plan was created by overriding one or more of the + * parent's prices + */ + fun basePlanId(basePlanId: JsonField) = apply { this.basePlanId = basePlanId } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - fun status(status: Status) = status(JsonField.of(status)) + /** + * An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun status(status: JsonField) = apply { this.status = status } + /** + * An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + /** + * The default memo text on the invoices corresponding to subscriptions on this plan. Note + * that each subscription may configure its own memo. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + /** + * The default memo text on the invoices corresponding to subscriptions on this plan. Note + * that each subscription may configure its own memo. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) + fun description(description: String) = description(JsonField.of(description)) - fun minimum(minimum: JsonField) = apply { this.minimum = minimum } + fun description(description: JsonField) = apply { this.description = description } fun discount(discount: Discount) = discount(JsonField.of(discount)) fun discount(discount: JsonField) = apply { this.discount = discount } - fun product(product: Product) = product(JsonField.of(product)) - - fun product(product: JsonField) = apply { this.product = product } - - fun version(version: Long) = version(JsonField.of(version)) - - fun version(version: JsonField) = apply { this.version = version } - - fun trialConfig(trialConfig: TrialConfig) = trialConfig(JsonField.of(trialConfig)) - - fun trialConfig(trialConfig: JsonField) = apply { - this.trialConfig = trialConfig - } - - fun planPhases(planPhases: List) = planPhases(JsonField.of(planPhases)) - - fun planPhases(planPhases: JsonField>) = apply { - this.planPhases = planPhases - } - - fun basePlan(basePlan: BasePlan) = basePlan(JsonField.of(basePlan)) - - fun basePlan(basePlan: JsonField) = apply { this.basePlan = basePlan } - - /** - * The parent plan id if the given plan was created by overriding one or more of the - * parent's prices - */ - fun basePlanId(basePlanId: String) = basePlanId(JsonField.of(basePlanId)) - - /** - * The parent plan id if the given plan was created by overriding one or more of the - * parent's prices - */ - fun basePlanId(basePlanId: JsonField) = apply { this.basePlanId = basePlanId } - /** * An optional user-defined ID for this plan resource, used throughout the system as an * alias for this Plan. Use this field to identify a plan by an existing identifier in your @@ -495,16 +472,6 @@ private constructor( this.externalPlanId = externalPlanId } - /** - * An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. - */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** - * An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's prices. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } - /** * An ISO 4217 currency string for which this plan is billed in. Matches `currency` unless * `currency` is a custom pricing unit. @@ -520,6 +487,44 @@ private constructor( this.invoicingCurrency = invoicingCurrency } + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) + + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } + + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + + fun name(name: String) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + /** * Determines the difference between the invoice issue date and the due date. A value of "0" * here signifies that invoices are due on issue, whereas a value of "30" means that the @@ -536,19 +541,10 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - /** - * The default memo text on the invoices corresponding to subscriptions on this plan. Note - * that each subscription may configure its own memo. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun planPhases(planPhases: List) = planPhases(JsonField.of(planPhases)) - /** - * The default memo text on the invoices corresponding to subscriptions on this plan. Note - * that each subscription may configure its own memo. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun planPhases(planPhases: JsonField>) = apply { + this.planPhases = planPhases } /** @@ -563,20 +559,24 @@ private constructor( */ fun prices(prices: JsonField>) = apply { this.prices = prices } - /** - * Adjustments for this plan. If the plan has phases, this includes adjustments across all - * phases of the plan. - */ - fun adjustments(adjustments: List) = adjustments(JsonField.of(adjustments)) + fun product(product: Product) = product(JsonField.of(product)) - /** - * Adjustments for this plan. If the plan has phases, this includes adjustments across all - * phases of the plan. - */ - fun adjustments(adjustments: JsonField>) = apply { - this.adjustments = adjustments + fun product(product: JsonField) = apply { this.product = product } + + fun status(status: Status) = status(JsonField.of(status)) + + fun status(status: JsonField) = apply { this.status = status } + + fun trialConfig(trialConfig: TrialConfig) = trialConfig(JsonField.of(trialConfig)) + + fun trialConfig(trialConfig: JsonField) = apply { + this.trialConfig = trialConfig } + fun version(version: Long) = version(JsonField.of(version)) + + fun version(version: JsonField) = apply { this.version = version } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -598,30 +598,30 @@ private constructor( fun build(): Plan = Plan( - metadata, id, - name, - description, - maximumAmount, - minimumAmount, - createdAt, - status, - maximum, - minimum, - discount, - product, - version, - trialConfig, - planPhases.map { it.toImmutable() }, + adjustments.map { it.toImmutable() }, basePlan, basePlanId, - externalPlanId, + createdAt, currency, + defaultInvoiceMemo, + description, + discount, + externalPlanId, invoicingCurrency, + maximum, + maximumAmount, + metadata, + minimum, + minimumAmount, + name, netTerms, - defaultInvoiceMemo, + planPhases.map { it.toImmutable() }, prices.map { it.toImmutable() }, - adjustments.map { it.toImmutable() }, + product, + status, + trialConfig, + version, additionalProperties.toImmutable(), ) } @@ -864,30 +864,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -898,22 +910,23 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -924,22 +937,9 @@ private constructor( /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -949,12 +949,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -969,23 +969,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -994,6 +994,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1018,43 +1049,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1080,12 +1080,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1146,17 +1146,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1166,75 +1166,69 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The percentage (as a value between 0 and 1) by which to discount the price intervals + * this adjustment applies to in a given billing period. + */ + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - - /** - * The percentage (as a value between 0 and 1) by which to discount the price intervals - * this adjustment applies to in a given billing period. - */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel - - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price intervals @@ -1244,6 +1238,12 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1253,12 +1253,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1273,54 +1273,37 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } - fun id(id: String) = id(JsonField.of(id)) - - fun id(id: JsonField) = apply { this.id = id } - - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } + fun id(id: String) = id(JsonField.of(id)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun id(id: JsonField) = apply { this.id = id } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1332,17 +1315,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1360,6 +1345,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1385,12 +1385,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1451,17 +1451,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1471,21 +1471,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1495,6 +1495,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1505,15 +1511,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies to * in a given billing period. @@ -1522,6 +1522,13 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1531,16 +1538,9 @@ private constructor( /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies to * in a given billing period. @@ -1556,11 +1556,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1576,22 +1576,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1601,6 +1601,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1625,28 +1641,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1687,11 +1687,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -1753,17 +1753,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1773,51 +1773,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this adjustment @@ -1825,29 +1821,30 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel - @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this adjustment @@ -1855,8 +1852,11 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -1867,13 +1867,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -1888,25 +1888,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -1914,6 +1914,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1929,36 +1945,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -1975,11 +1966,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2006,13 +2006,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2073,17 +2073,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2093,75 +2093,69 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this adjustment + * applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - - /** - * The maximum amount to charge in a given billing period for the prices this adjustment - * applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel - - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel /** * The maximum amount to charge in a given billing period for the prices this adjustment @@ -2169,6 +2163,12 @@ private constructor( */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2178,12 +2178,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2198,23 +2198,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2222,28 +2222,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2255,17 +2238,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2283,6 +2268,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2308,12 +2308,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2374,17 +2374,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2538,19 +2538,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this * can be a subset of prices. @@ -2559,7 +2556,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, this @@ -2569,6 +2566,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2577,8 +2577,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -2592,25 +2592,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -2626,6 +2618,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2647,8 +2647,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -2658,17 +2658,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -2755,19 +2755,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this * can be a subset of prices. @@ -2776,7 +2773,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, this @@ -2786,6 +2783,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2794,8 +2794,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -2809,25 +2809,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -2843,6 +2835,14 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2864,8 +2864,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -2875,17 +2875,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2896,33 +2896,33 @@ private constructor( @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), + @JsonProperty("discount") + @ExcludeMissing + private val discount: JsonField = JsonMissing.of(), @JsonProperty("duration") @ExcludeMissing private val duration: JsonField = JsonMissing.of(), @JsonProperty("duration_unit") @ExcludeMissing private val durationUnit: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("order") - @ExcludeMissing - private val order: JsonField = JsonMissing.of(), - @JsonProperty("minimum") - @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("minimum") + @ExcludeMissing + private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("discount") + @JsonProperty("name") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("order") + @ExcludeMissing + private val order: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -2932,6 +2932,8 @@ private constructor( fun description(): Optional = Optional.ofNullable(description.getNullable("description")) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) + /** * How many terms of length `duration_unit` this phase is active for. If null, this phase is * evergreen and active indefinitely @@ -2941,27 +2943,27 @@ private constructor( fun durationUnit(): Optional = Optional.ofNullable(durationUnit.getNullable("duration_unit")) - fun name(): String = name.getRequired("name") - - /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ - fun order(): Long = order.getRequired("order") - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) + fun name(): String = name.getRequired("name") + + /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ + fun order(): Long = order.getRequired("order") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("description") @ExcludeMissing fun _description() = description + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + /** * How many terms of length `duration_unit` this phase is active for. If null, this phase is * evergreen and active indefinitely @@ -2970,20 +2972,18 @@ private constructor( @JsonProperty("duration_unit") @ExcludeMissing fun _durationUnit() = durationUnit - @JsonProperty("name") @ExcludeMissing fun _name() = name - - /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ - @JsonProperty("order") @ExcludeMissing fun _order() = order - - @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ + @JsonProperty("order") @ExcludeMissing fun _order() = order @JsonAnyGetter @ExcludeMissing @@ -2995,15 +2995,15 @@ private constructor( if (!validated) { id() description() + discount() duration() durationUnit() - name() - order() - minimum().map { it.validate() } maximum().map { it.validate() } maximumAmount() + minimum().map { it.validate() } minimumAmount() - discount() + name() + order() validated = true } } @@ -3019,30 +3019,30 @@ private constructor( private var id: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() + private var discount: JsonField = JsonMissing.of() private var duration: JsonField = JsonMissing.of() private var durationUnit: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var order: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() - private var discount: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var order: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(planPhase: PlanPhase) = apply { id = planPhase.id description = planPhase.description + discount = planPhase.discount duration = planPhase.duration durationUnit = planPhase.durationUnit - name = planPhase.name - order = planPhase.order - minimum = planPhase.minimum maximum = planPhase.maximum maximumAmount = planPhase.maximumAmount + minimum = planPhase.minimum minimumAmount = planPhase.minimumAmount - discount = planPhase.discount + name = planPhase.name + order = planPhase.order additionalProperties = planPhase.additionalProperties.toMutableMap() } @@ -3056,6 +3056,10 @@ private constructor( this.description = description } + fun discount(discount: Discount) = discount(JsonField.of(discount)) + + fun discount(discount: JsonField) = apply { this.discount = discount } + /** * How many terms of length `duration_unit` this phase is active for. If null, this * phase is evergreen and active indefinitely @@ -3074,20 +3078,6 @@ private constructor( this.durationUnit = durationUnit } - fun name(name: String) = name(JsonField.of(name)) - - fun name(name: JsonField) = apply { this.name = name } - - /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ - fun order(order: Long) = order(JsonField.of(order)) - - /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ - fun order(order: JsonField) = apply { this.order = order } - - fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) - - fun minimum(minimum: JsonField) = apply { this.minimum = minimum } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) fun maximum(maximum: JsonField) = apply { this.maximum = maximum } @@ -3098,15 +3088,25 @@ private constructor( this.maximumAmount = maximumAmount } + fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) + + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) fun minimumAmount(minimumAmount: JsonField) = apply { this.minimumAmount = minimumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + fun name(name: String) = name(JsonField.of(name)) - fun discount(discount: JsonField) = apply { this.discount = discount } + fun name(name: JsonField) = apply { this.name = name } + + /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ + fun order(order: Long) = order(JsonField.of(order)) + + /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ + fun order(order: JsonField) = apply { this.order = order } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3131,15 +3131,15 @@ private constructor( PlanPhase( id, description, + discount, duration, durationUnit, - name, - order, - minimum, maximum, maximumAmount, + minimum, minimumAmount, - discount, + name, + order, additionalProperties.toImmutable(), ) } @@ -3223,19 +3223,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -3244,7 +3241,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -3254,6 +3251,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3262,8 +3262,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -3277,26 +3277,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -3312,6 +3303,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3336,8 +3336,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -3347,36 +3347,33 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } @NoAutoDetect class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -3385,7 +3382,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -3395,6 +3392,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3403,8 +3403,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -3418,26 +3418,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -3453,6 +3444,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3477,8 +3477,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -3488,17 +3488,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3506,27 +3506,27 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhase && id == other.id && description == other.description && duration == other.duration && durationUnit == other.durationUnit && name == other.name && order == other.order && minimum == other.minimum && maximum == other.maximum && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && discount == other.discount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PlanPhase && id == other.id && description == other.description && discount == other.discount && duration == other.duration && durationUnit == other.durationUnit && maximum == other.maximum && maximumAmount == other.maximumAmount && minimum == other.minimum && minimumAmount == other.minimumAmount && name == other.name && order == other.order && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, description, duration, durationUnit, name, order, minimum, maximum, maximumAmount, minimumAmount, discount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, description, discount, duration, durationUnit, maximum, maximumAmount, minimum, minimumAmount, name, order, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhase{id=$id, description=$description, duration=$duration, durationUnit=$durationUnit, name=$name, order=$order, minimum=$minimum, maximum=$maximum, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, discount=$discount, additionalProperties=$additionalProperties}" + "PlanPhase{id=$id, description=$description, discount=$discount, duration=$duration, durationUnit=$durationUnit, maximum=$maximum, maximumAmount=$maximumAmount, minimum=$minimum, minimumAmount=$minimumAmount, name=$name, order=$order, additionalProperties=$additionalProperties}" } @NoAutoDetect class Product @JsonCreator private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @@ -3534,16 +3534,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun id(): String = id.getRequired("id") - fun name(): String = name.getRequired("name") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun name(): String = name.getRequired("name") @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonAnyGetter @@ -3554,8 +3554,8 @@ private constructor( fun validate(): Product = apply { if (!validated) { - createdAt() id() + createdAt() name() validated = true } @@ -3570,29 +3570,29 @@ private constructor( class Builder { - private var createdAt: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(product: Product) = apply { - createdAt = product.createdAt id = product.id + createdAt = product.createdAt name = product.name additionalProperties = product.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - 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 } @@ -3618,8 +3618,8 @@ private constructor( fun build(): Product = Product( - createdAt, id, + createdAt, name, additionalProperties.toImmutable(), ) @@ -3630,17 +3630,17 @@ private constructor( return true } - return /* spotless:off */ other is Product && createdAt == other.createdAt && id == other.id && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Product && id == other.id && createdAt == other.createdAt && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(createdAt, id, name, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, createdAt, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Product{createdAt=$createdAt, id=$id, name=$name, additionalProperties=$additionalProperties}" + "Product{id=$id, createdAt=$createdAt, name=$name, additionalProperties=$additionalProperties}" } class Status @@ -3875,15 +3875,15 @@ private constructor( return true } - return /* spotless:off */ other is Plan && metadata == other.metadata && id == other.id && name == other.name && description == other.description && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && createdAt == other.createdAt && status == other.status && maximum == other.maximum && minimum == other.minimum && discount == other.discount && product == other.product && version == other.version && trialConfig == other.trialConfig && planPhases == other.planPhases && basePlan == other.basePlan && basePlanId == other.basePlanId && externalPlanId == other.externalPlanId && currency == other.currency && invoicingCurrency == other.invoicingCurrency && netTerms == other.netTerms && defaultInvoiceMemo == other.defaultInvoiceMemo && prices == other.prices && adjustments == other.adjustments && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Plan && id == other.id && adjustments == other.adjustments && basePlan == other.basePlan && basePlanId == other.basePlanId && createdAt == other.createdAt && currency == other.currency && defaultInvoiceMemo == other.defaultInvoiceMemo && description == other.description && discount == other.discount && externalPlanId == other.externalPlanId && invoicingCurrency == other.invoicingCurrency && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && name == other.name && netTerms == other.netTerms && planPhases == other.planPhases && prices == other.prices && product == other.product && status == other.status && trialConfig == other.trialConfig && version == other.version && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, description, maximumAmount, minimumAmount, createdAt, status, maximum, minimum, discount, product, version, trialConfig, planPhases, basePlan, basePlanId, externalPlanId, currency, invoicingCurrency, netTerms, defaultInvoiceMemo, prices, adjustments, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustments, basePlan, basePlanId, createdAt, currency, defaultInvoiceMemo, description, discount, externalPlanId, invoicingCurrency, maximum, maximumAmount, metadata, minimum, minimumAmount, name, netTerms, planPhases, prices, product, status, trialConfig, version, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Plan{metadata=$metadata, id=$id, name=$name, description=$description, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, createdAt=$createdAt, status=$status, maximum=$maximum, minimum=$minimum, discount=$discount, product=$product, version=$version, trialConfig=$trialConfig, planPhases=$planPhases, basePlan=$basePlan, basePlanId=$basePlanId, externalPlanId=$externalPlanId, currency=$currency, invoicingCurrency=$invoicingCurrency, netTerms=$netTerms, defaultInvoiceMemo=$defaultInvoiceMemo, prices=$prices, adjustments=$adjustments, additionalProperties=$additionalProperties}" + "Plan{id=$id, adjustments=$adjustments, basePlan=$basePlan, basePlanId=$basePlanId, createdAt=$createdAt, currency=$currency, defaultInvoiceMemo=$defaultInvoiceMemo, description=$description, discount=$discount, externalPlanId=$externalPlanId, invoicingCurrency=$invoicingCurrency, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, name=$name, netTerms=$netTerms, planPhases=$planPhases, prices=$prices, product=$product, status=$status, trialConfig=$trialConfig, version=$version, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt index 48acfd10..ff338b26 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt @@ -193,32 +193,65 @@ constructor( } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { this.defaultInvoiceMemo = defaultInvoiceMemo } - fun externalPlanId(externalPlanId: String) = apply { + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + + fun externalPlanId(externalPlanId: String?) = apply { this.externalPlanId = externalPlanId } + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * The net terms determines the difference between the invoice date and the issue date + * for the invoice. If you intend the invoice to be due on issue, set this to 0. + */ + fun netTerms(netTerms: Long?) = apply { this.netTerms = netTerms } + + /** + * The net terms determines the difference between the invoice date and the issue date + * for the invoice. If you intend the invoice to be due on issue, set this to 0. + */ + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) /** * The net terms determines the difference between the invoice date and the issue date * for the invoice. If you intend the invoice to be due on issue, set this to 0. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.orElse(null) as Long?) + + /** + * The status of the plan to create (either active or draft). If not specified, this + * defaults to active. + */ + fun status(status: Status?) = apply { this.status = status } /** * The status of the plan to create (either active or draft). If not specified, this * defaults to active. */ - fun status(status: Status) = apply { this.status = status } + fun status(status: Optional) = status(status.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -310,30 +343,63 @@ constructor( fun addPrice(price: Price) = apply { body.addPrice(price) } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { body.defaultInvoiceMemo(defaultInvoiceMemo) } - fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + + fun externalPlanId(externalPlanId: String?) = apply { body.externalPlanId(externalPlanId) } + + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * The net terms determines the difference between the invoice date and the issue date for + * the invoice. If you intend the invoice to be due on issue, set this to 0. + */ + fun netTerms(netTerms: Long?) = apply { body.netTerms(netTerms) } + + /** + * The net terms determines the difference between the invoice date and the issue date for + * the invoice. If you intend the invoice to be due on issue, set this to 0. + */ + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) /** * The net terms determines the difference between the invoice date and the issue date for * the invoice. If you intend the invoice to be due on issue, set this to 0. */ - fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.orElse(null) as Long?) + + /** + * The status of the plan to create (either active or draft). If not specified, this + * defaults to active. + */ + fun status(status: Status?) = apply { body.status(status) } /** * The status of the plan to create (either active or draft). If not specified, this * defaults to active. */ - fun status(status: Status) = apply { body.status(status) } + fun status(status: Optional) = status(status.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -1136,51 +1202,46 @@ constructor( class NewPlanUnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -1188,6 +1249,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -1198,16 +1281,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -1216,20 +1289,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -1244,163 +1310,246 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitConfig: UnitConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitConfig: UnitConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanUnitPrice: NewPlanUnitPrice) = apply { - metadata = newPlanUnitPrice.metadata - externalPriceId = newPlanUnitPrice.externalPriceId + cadence = newPlanUnitPrice.cadence + itemId = newPlanUnitPrice.itemId + modelType = newPlanUnitPrice.modelType name = newPlanUnitPrice.name + unitConfig = newPlanUnitPrice.unitConfig billableMetricId = newPlanUnitPrice.billableMetricId - itemId = newPlanUnitPrice.itemId billedInAdvance = newPlanUnitPrice.billedInAdvance - fixedPriceQuantity = newPlanUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanUnitPrice.invoiceGroupingKey - cadence = newPlanUnitPrice.cadence billingCycleConfiguration = newPlanUnitPrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanUnitPrice.invoicingCycleConfiguration conversionRate = newPlanUnitPrice.conversionRate - modelType = newPlanUnitPrice.modelType - unitConfig = newPlanUnitPrice.unitConfig currency = newPlanUnitPrice.currency + externalPriceId = newPlanUnitPrice.externalPriceId + fixedPriceQuantity = newPlanUnitPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanUnitPrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanUnitPrice.invoicingCycleConfiguration + metadata = newPlanUnitPrice.metadata additionalProperties = newPlanUnitPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - fun build(): NewPlanUnitPrice = - NewPlanUnitPrice( - metadata, - externalPriceId, + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): NewPlanUnitPrice = + NewPlanUnitPrice( + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -2024,68 +2173,63 @@ constructor( return true } - return /* spotless:off */ other is NewPlanUnitPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitConfig == other.unitConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanUnitPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanUnitPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitConfig=$unitConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanUnitPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -2093,6 +2237,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -2103,16 +2269,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -2121,20 +2277,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -2149,125 +2298,208 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageConfig: PackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageConfig: PackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanPackagePrice: NewPlanPackagePrice) = apply { - metadata = newPlanPackagePrice.metadata - externalPriceId = newPlanPackagePrice.externalPriceId + cadence = newPlanPackagePrice.cadence + itemId = newPlanPackagePrice.itemId + modelType = newPlanPackagePrice.modelType name = newPlanPackagePrice.name + packageConfig = newPlanPackagePrice.packageConfig billableMetricId = newPlanPackagePrice.billableMetricId - itemId = newPlanPackagePrice.itemId billedInAdvance = newPlanPackagePrice.billedInAdvance - fixedPriceQuantity = newPlanPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanPackagePrice.invoiceGroupingKey - cadence = newPlanPackagePrice.cadence billingCycleConfiguration = newPlanPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanPackagePrice.invoicingCycleConfiguration conversionRate = newPlanPackagePrice.conversionRate - modelType = newPlanPackagePrice.modelType - packageConfig = newPlanPackagePrice.packageConfig currency = newPlanPackagePrice.currency + externalPriceId = newPlanPackagePrice.externalPriceId + fixedPriceQuantity = newPlanPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newPlanPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanPackagePrice.invoicingCycleConfiguration + metadata = newPlanPackagePrice.metadata additionalProperties = newPlanPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageConfig(packageConfig: PackageConfig) = apply { + this.packageConfig = packageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun packageConfig(packageConfig: PackageConfig) = apply { - this.packageConfig = packageConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2293,23 +2525,23 @@ constructor( fun build(): NewPlanPackagePrice = NewPlanPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageConfig) { "`packageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -2955,55 +3187,53 @@ constructor( return true } - return /* spotless:off */ other is NewPlanPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageConfig == other.packageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageConfig=$packageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanMatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -3014,9 +3244,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -3024,6 +3251,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -3034,16 +3283,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -3052,20 +3291,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -3080,55 +3312,55 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var matrixConfig: MatrixConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixConfig: MatrixConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanMatrixPrice: NewPlanMatrixPrice) = apply { - metadata = newPlanMatrixPrice.metadata - externalPriceId = newPlanMatrixPrice.externalPriceId + cadence = newPlanMatrixPrice.cadence + itemId = newPlanMatrixPrice.itemId + matrixConfig = newPlanMatrixPrice.matrixConfig + modelType = newPlanMatrixPrice.modelType name = newPlanMatrixPrice.name billableMetricId = newPlanMatrixPrice.billableMetricId - itemId = newPlanMatrixPrice.itemId billedInAdvance = newPlanMatrixPrice.billedInAdvance - fixedPriceQuantity = newPlanMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanMatrixPrice.invoiceGroupingKey - cadence = newPlanMatrixPrice.cadence billingCycleConfiguration = newPlanMatrixPrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanMatrixPrice.invoicingCycleConfiguration conversionRate = newPlanMatrixPrice.conversionRate - modelType = newPlanMatrixPrice.modelType - matrixConfig = newPlanMatrixPrice.matrixConfig currency = newPlanMatrixPrice.currency + externalPriceId = newPlanMatrixPrice.externalPriceId + fixedPriceQuantity = newPlanMatrixPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanMatrixPrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanMatrixPrice.invoicingCycleConfiguration + metadata = newPlanMatrixPrice.metadata additionalProperties = newPlanMatrixPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = apply { + this.matrixConfig = matrixConfig } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -3136,69 +3368,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun matrixConfig(matrixConfig: MatrixConfig) = apply { - this.matrixConfig = matrixConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3224,21 +3539,21 @@ constructor( fun build(): NewPlanMatrixPrice = NewPlanMatrixPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixConfig) { "`matrixConfig` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixConfig) { "`matrixConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -3328,22 +3643,22 @@ constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions - /** * Default per unit rate for any usage not bucketed into a specified matrix_value */ @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues @@ -3360,19 +3675,27 @@ constructor( class Builder { - private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions.toMutableList() defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.toMutableList() matrixValues = matrixConfig.matrixValues.toMutableList() additionalProperties = matrixConfig.additionalProperties.toMutableMap() } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -3383,14 +3706,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified - * matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -3425,11 +3740,11 @@ constructor( fun build(): MatrixConfig = MatrixConfig( - checkNotNull(dimensions) { "`dimensions` is required but was not set" } - .toImmutable(), checkNotNull(defaultUnitAmount) { "`defaultUnitAmount` is required but was not set" }, + checkNotNull(dimensions) { "`dimensions` is required but was not set" } + .toImmutable(), checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } @@ -3442,15 +3757,12 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and @@ -3459,6 +3771,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3472,21 +3787,18 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -3506,6 +3818,9 @@ constructor( (dimensionValues ?: mutableListOf()).apply { add(dimensionValue) } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3530,13 +3845,13 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { - "`unitAmount` is required but was not set" - }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { + "`unitAmount` is required but was not set" + }, additionalProperties.toImmutable(), ) } @@ -3546,17 +3861,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3564,17 +3879,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -4031,68 +4346,63 @@ constructor( return true } - return /* spotless:off */ other is NewPlanMatrixPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixConfig == other.matrixConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanMatrixPrice && cadence == other.cadence && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanMatrixPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixConfig=$matrixConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanMatrixPrice{cadence=$cadence, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -4100,6 +4410,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -4110,16 +4442,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -4128,20 +4450,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -4156,125 +4471,208 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredConfig: TieredConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredConfig: TieredConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanTieredPrice: NewPlanTieredPrice) = apply { - metadata = newPlanTieredPrice.metadata - externalPriceId = newPlanTieredPrice.externalPriceId + cadence = newPlanTieredPrice.cadence + itemId = newPlanTieredPrice.itemId + modelType = newPlanTieredPrice.modelType name = newPlanTieredPrice.name + tieredConfig = newPlanTieredPrice.tieredConfig billableMetricId = newPlanTieredPrice.billableMetricId - itemId = newPlanTieredPrice.itemId billedInAdvance = newPlanTieredPrice.billedInAdvance - fixedPriceQuantity = newPlanTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTieredPrice.invoiceGroupingKey - cadence = newPlanTieredPrice.cadence billingCycleConfiguration = newPlanTieredPrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanTieredPrice.invoicingCycleConfiguration conversionRate = newPlanTieredPrice.conversionRate - modelType = newPlanTieredPrice.modelType - tieredConfig = newPlanTieredPrice.tieredConfig currency = newPlanTieredPrice.currency + externalPriceId = newPlanTieredPrice.externalPriceId + fixedPriceQuantity = newPlanTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanTieredPrice.invoicingCycleConfiguration + metadata = newPlanTieredPrice.metadata additionalProperties = newPlanTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredConfig(tieredConfig: TieredConfig) = apply { + this.tieredConfig = tieredConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun tieredConfig(tieredConfig: TieredConfig) = apply { - this.tieredConfig = tieredConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4300,21 +4698,21 @@ constructor( fun build(): NewPlanTieredPrice = NewPlanTieredPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -4528,8 +4926,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("first_unit") private val firstUnit: Double, - @JsonProperty("last_unit") private val lastUnit: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("last_unit") private val lastUnit: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -4537,13 +4935,13 @@ constructor( /** Inclusive tier starting value */ @JsonProperty("first_unit") fun firstUnit(): Double = firstUnit + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Exclusive tier ending value. If null, this is treated as the last tier */ @JsonProperty("last_unit") fun lastUnit(): Optional = Optional.ofNullable(lastUnit) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4558,29 +4956,43 @@ constructor( class Builder { private var firstUnit: Double? = null - private var lastUnit: Double? = null private var unitAmount: String? = null + private var lastUnit: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } /** Inclusive tier starting value */ fun firstUnit(firstUnit: Double) = apply { this.firstUnit = firstUnit } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** * Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: Double) = apply { this.lastUnit = lastUnit } + fun lastUnit(lastUnit: Double?) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** + * Exclusive tier ending value. If null, this is treated as the last tier + */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last tier + */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { @@ -4609,10 +5021,10 @@ constructor( checkNotNull(firstUnit) { "`firstUnit` is required but was not set" }, - lastUnit, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + lastUnit, additionalProperties.toImmutable(), ) } @@ -4622,17 +5034,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5056,68 +5468,64 @@ constructor( return true } - return /* spotless:off */ other is NewPlanTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredConfig == other.tieredConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredConfig=$tieredConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanTieredPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanTieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_bps_config") + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -5125,6 +5533,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -5135,16 +5565,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -5153,21 +5573,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_bps_config") - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -5182,125 +5594,208 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredBpsConfig: TieredBpsConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredBpsConfig: TieredBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanTieredBpsPrice: NewPlanTieredBpsPrice) = apply { - metadata = newPlanTieredBpsPrice.metadata - externalPriceId = newPlanTieredBpsPrice.externalPriceId + cadence = newPlanTieredBpsPrice.cadence + itemId = newPlanTieredBpsPrice.itemId + modelType = newPlanTieredBpsPrice.modelType name = newPlanTieredBpsPrice.name + tieredBpsConfig = newPlanTieredBpsPrice.tieredBpsConfig billableMetricId = newPlanTieredBpsPrice.billableMetricId - itemId = newPlanTieredBpsPrice.itemId billedInAdvance = newPlanTieredBpsPrice.billedInAdvance - fixedPriceQuantity = newPlanTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTieredBpsPrice.invoiceGroupingKey - cadence = newPlanTieredBpsPrice.cadence billingCycleConfiguration = newPlanTieredBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanTieredBpsPrice.invoicingCycleConfiguration conversionRate = newPlanTieredBpsPrice.conversionRate - modelType = newPlanTieredBpsPrice.modelType - tieredBpsConfig = newPlanTieredBpsPrice.tieredBpsConfig currency = newPlanTieredBpsPrice.currency + externalPriceId = newPlanTieredBpsPrice.externalPriceId + fixedPriceQuantity = newPlanTieredBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanTieredBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanTieredBpsPrice.invoicingCycleConfiguration + metadata = newPlanTieredBpsPrice.metadata additionalProperties = newPlanTieredBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { + this.tieredBpsConfig = tieredBpsConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { - this.tieredBpsConfig = tieredBpsConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5326,23 +5821,23 @@ constructor( fun build(): NewPlanTieredBpsPrice = NewPlanTieredBpsPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredBpsConfig) { "`tieredBpsConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -5564,14 +6059,17 @@ constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") private val bps: Double, @JsonProperty("minimum_amount") private val minimumAmount: String, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("bps") private val bps: Double, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + @JsonProperty("bps") fun bps(): Double = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount @@ -5579,9 +6077,6 @@ constructor( @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Per-event basis point rate */ - @JsonProperty("bps") fun bps(): Double = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -5599,40 +6094,48 @@ constructor( class Builder { + private var bps: Double? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var bps: Double? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5657,11 +6160,11 @@ constructor( fun build(): Tier = Tier( + checkNotNull(bps) { "`bps` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, maximumAmount, - checkNotNull(bps) { "`bps` is required but was not set" }, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -5672,17 +6175,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -6106,55 +6609,53 @@ constructor( return true } - return /* spotless:off */ other is NewPlanTieredBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredBpsConfig == other.tieredBpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredBpsPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredBpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredBpsConfig=$tieredBpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanTieredBpsPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bps_config") private val bpsConfig: BpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bps_config") private val bpsConfig: BpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -6165,9 +6666,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -6175,19 +6673,6 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @JsonProperty("fixed_price_quantity") - fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -6195,22 +6680,10 @@ constructor( fun billingCycleConfiguration(): Optional = Optional.ofNullable(billingCycleConfiguration) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ @JsonProperty("conversion_rate") fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this price * is billed. @@ -6218,6 +6691,36 @@ constructor( @JsonProperty("currency") fun currency(): Optional = Optional.ofNullable(currency) + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable(invoicingCycleConfiguration) + + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6231,54 +6734,52 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bpsConfig: BpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bpsConfig: BpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanBpsPrice: NewPlanBpsPrice) = apply { - metadata = newPlanBpsPrice.metadata - externalPriceId = newPlanBpsPrice.externalPriceId + bpsConfig = newPlanBpsPrice.bpsConfig + cadence = newPlanBpsPrice.cadence + itemId = newPlanBpsPrice.itemId + modelType = newPlanBpsPrice.modelType name = newPlanBpsPrice.name billableMetricId = newPlanBpsPrice.billableMetricId - itemId = newPlanBpsPrice.itemId billedInAdvance = newPlanBpsPrice.billedInAdvance - fixedPriceQuantity = newPlanBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBpsPrice.invoiceGroupingKey - cadence = newPlanBpsPrice.cadence billingCycleConfiguration = newPlanBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanBpsPrice.invoicingCycleConfiguration conversionRate = newPlanBpsPrice.conversionRate - modelType = newPlanBpsPrice.modelType - bpsConfig = newPlanBpsPrice.bpsConfig currency = newPlanBpsPrice.currency + externalPriceId = newPlanBpsPrice.externalPriceId + fixedPriceQuantity = newPlanBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanBpsPrice.invoicingCycleConfiguration + metadata = newPlanBpsPrice.metadata additionalProperties = newPlanBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -6287,67 +6788,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6373,21 +6959,21 @@ constructor( fun build(): NewPlanBpsPrice = NewPlanBpsPrice( - metadata, - externalPriceId, + checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -6437,10 +7023,14 @@ constructor( fun bps(bps: Double) = apply { this.bps = bps } /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7024,55 +7614,53 @@ constructor( return true } - return /* spotless:off */ other is NewPlanBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bpsConfig == other.bpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bpsConfig=$bpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanBulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -7083,9 +7671,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -7093,19 +7678,6 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @JsonProperty("fixed_price_quantity") - fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -7113,22 +7685,10 @@ constructor( fun billingCycleConfiguration(): Optional = Optional.ofNullable(billingCycleConfiguration) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ @JsonProperty("conversion_rate") fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this price * is billed. @@ -7136,6 +7696,36 @@ constructor( @JsonProperty("currency") fun currency(): Optional = Optional.ofNullable(currency) + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable(invoicingCycleConfiguration) + + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7149,55 +7739,55 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkBpsConfig: BulkBpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkBpsConfig: BulkBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanBulkBpsPrice: NewPlanBulkBpsPrice) = apply { - metadata = newPlanBulkBpsPrice.metadata - externalPriceId = newPlanBulkBpsPrice.externalPriceId + bulkBpsConfig = newPlanBulkBpsPrice.bulkBpsConfig + cadence = newPlanBulkBpsPrice.cadence + itemId = newPlanBulkBpsPrice.itemId + modelType = newPlanBulkBpsPrice.modelType name = newPlanBulkBpsPrice.name billableMetricId = newPlanBulkBpsPrice.billableMetricId - itemId = newPlanBulkBpsPrice.itemId billedInAdvance = newPlanBulkBpsPrice.billedInAdvance - fixedPriceQuantity = newPlanBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBulkBpsPrice.invoiceGroupingKey - cadence = newPlanBulkBpsPrice.cadence billingCycleConfiguration = newPlanBulkBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanBulkBpsPrice.invoicingCycleConfiguration conversionRate = newPlanBulkBpsPrice.conversionRate - modelType = newPlanBulkBpsPrice.modelType - bulkBpsConfig = newPlanBulkBpsPrice.bulkBpsConfig currency = newPlanBulkBpsPrice.currency + externalPriceId = newPlanBulkBpsPrice.externalPriceId + fixedPriceQuantity = newPlanBulkBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanBulkBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanBulkBpsPrice.invoicingCycleConfiguration + metadata = newPlanBulkBpsPrice.metadata additionalProperties = newPlanBulkBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { + this.bulkBpsConfig = bulkBpsConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -7205,69 +7795,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { - this.bulkBpsConfig = bulkBpsConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7293,23 +7966,23 @@ constructor( fun build(): NewPlanBulkBpsPrice = NewPlanBulkBpsPrice( - metadata, - externalPriceId, + checkNotNull(bulkBpsConfig) { + "`bulkBpsConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkBpsConfig) { - "`bulkBpsConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -7399,20 +8072,20 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("bps") private val bps: Double, + @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + @JsonProperty("bps") fun bps(): Double = bps + /** Upper bound for tier */ @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Basis points to rate on */ - @JsonProperty("bps") fun bps(): Double = bps - /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -7430,33 +8103,41 @@ constructor( class Builder { - private var maximumAmount: String? = null private var bps: Double? = null + private var maximumAmount: String? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7481,8 +8162,8 @@ constructor( fun build(): Tier = Tier( - maximumAmount, checkNotNull(bps) { "`bps` is required but was not set" }, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -7493,17 +8174,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -8059,55 +8740,53 @@ constructor( return true } - return /* spotless:off */ other is NewPlanBulkBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkBpsConfig == other.bulkBpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkBpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBulkBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkBpsConfig=$bulkBpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanBulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -8118,9 +8797,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -8128,6 +8804,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -8138,16 +8836,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -8156,20 +8844,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -8184,54 +8865,52 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkConfig: BulkConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkConfig: BulkConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanBulkPrice: NewPlanBulkPrice) = apply { - metadata = newPlanBulkPrice.metadata - externalPriceId = newPlanBulkPrice.externalPriceId + bulkConfig = newPlanBulkPrice.bulkConfig + cadence = newPlanBulkPrice.cadence + itemId = newPlanBulkPrice.itemId + modelType = newPlanBulkPrice.modelType name = newPlanBulkPrice.name billableMetricId = newPlanBulkPrice.billableMetricId - itemId = newPlanBulkPrice.itemId billedInAdvance = newPlanBulkPrice.billedInAdvance - fixedPriceQuantity = newPlanBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBulkPrice.invoiceGroupingKey - cadence = newPlanBulkPrice.cadence billingCycleConfiguration = newPlanBulkPrice.billingCycleConfiguration - invoicingCycleConfiguration = newPlanBulkPrice.invoicingCycleConfiguration conversionRate = newPlanBulkPrice.conversionRate - modelType = newPlanBulkPrice.modelType - bulkConfig = newPlanBulkPrice.bulkConfig currency = newPlanBulkPrice.currency + externalPriceId = newPlanBulkPrice.externalPriceId + fixedPriceQuantity = newPlanBulkPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanBulkPrice.invoiceGroupingKey + invoicingCycleConfiguration = newPlanBulkPrice.invoicingCycleConfiguration + metadata = newPlanBulkPrice.metadata additionalProperties = newPlanBulkPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -8240,67 +8919,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8326,21 +9090,21 @@ constructor( fun build(): NewPlanBulkPrice = NewPlanBulkPrice( - metadata, - externalPriceId, + checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -8421,19 +9185,19 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Upper bound for this tier */ @JsonProperty("maximum_units") fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -8447,25 +9211,36 @@ constructor( class Builder { - private var maximumUnits: Double? = null private var unitAmount: String? = null + private var maximumUnits: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = apply { + fun maximumUnits(maximumUnits: Double?) = apply { this.maximumUnits = maximumUnits } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(maximumUnits as Double?) + + /** Upper bound for this tier */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { @@ -8491,10 +9266,10 @@ constructor( fun build(): Tier = Tier( - maximumUnits, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -8504,17 +9279,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -9070,69 +9845,66 @@ constructor( return true } - return /* spotless:off */ other is NewPlanBulkPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkConfig == other.bulkConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBulkPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkConfig=$bulkConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("threshold_total_amount_config") + private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("threshold_total_amount_config") - private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("threshold_total_amount_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -9140,6 +9912,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -9150,16 +9944,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -9168,22 +9952,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("threshold_total_amount_config") - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -9198,131 +9973,214 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newPlanThresholdTotalAmountPrice: NewPlanThresholdTotalAmountPrice ) = apply { - metadata = newPlanThresholdTotalAmountPrice.metadata - externalPriceId = newPlanThresholdTotalAmountPrice.externalPriceId + cadence = newPlanThresholdTotalAmountPrice.cadence + itemId = newPlanThresholdTotalAmountPrice.itemId + modelType = newPlanThresholdTotalAmountPrice.modelType name = newPlanThresholdTotalAmountPrice.name + thresholdTotalAmountConfig = + newPlanThresholdTotalAmountPrice.thresholdTotalAmountConfig billableMetricId = newPlanThresholdTotalAmountPrice.billableMetricId - itemId = newPlanThresholdTotalAmountPrice.itemId billedInAdvance = newPlanThresholdTotalAmountPrice.billedInAdvance - fixedPriceQuantity = newPlanThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanThresholdTotalAmountPrice.invoiceGroupingKey - cadence = newPlanThresholdTotalAmountPrice.cadence billingCycleConfiguration = newPlanThresholdTotalAmountPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanThresholdTotalAmountPrice.invoicingCycleConfiguration conversionRate = newPlanThresholdTotalAmountPrice.conversionRate - modelType = newPlanThresholdTotalAmountPrice.modelType - thresholdTotalAmountConfig = - newPlanThresholdTotalAmountPrice.thresholdTotalAmountConfig currency = newPlanThresholdTotalAmountPrice.currency + externalPriceId = newPlanThresholdTotalAmountPrice.externalPriceId + fixedPriceQuantity = newPlanThresholdTotalAmountPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanThresholdTotalAmountPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanThresholdTotalAmountPrice.invoicingCycleConfiguration + metadata = newPlanThresholdTotalAmountPrice.metadata additionalProperties = newPlanThresholdTotalAmountPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: ThresholdTotalAmountConfig + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: ThresholdTotalAmountConfig - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9348,23 +10206,23 @@ constructor( fun build(): NewPlanThresholdTotalAmountPrice = NewPlanThresholdTotalAmountPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(thresholdTotalAmountConfig) { "`thresholdTotalAmountConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -9978,69 +10836,65 @@ constructor( return true } - return /* spotless:off */ other is NewPlanThresholdTotalAmountPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanThresholdTotalAmountPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, thresholdTotalAmountConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanThresholdTotalAmountPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanThresholdTotalAmountPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_config") + private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_config") - private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_config") + fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -10048,6 +10902,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -10058,16 +10934,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -10076,21 +10942,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_config") - fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -10105,127 +10963,210 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageConfig: TieredPackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageConfig: TieredPackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanTieredPackagePrice: NewPlanTieredPackagePrice) = apply { - metadata = newPlanTieredPackagePrice.metadata - externalPriceId = newPlanTieredPackagePrice.externalPriceId + cadence = newPlanTieredPackagePrice.cadence + itemId = newPlanTieredPackagePrice.itemId + modelType = newPlanTieredPackagePrice.modelType name = newPlanTieredPackagePrice.name + tieredPackageConfig = newPlanTieredPackagePrice.tieredPackageConfig billableMetricId = newPlanTieredPackagePrice.billableMetricId - itemId = newPlanTieredPackagePrice.itemId billedInAdvance = newPlanTieredPackagePrice.billedInAdvance + billingCycleConfiguration = newPlanTieredPackagePrice.billingCycleConfiguration + conversionRate = newPlanTieredPackagePrice.conversionRate + currency = newPlanTieredPackagePrice.currency + externalPriceId = newPlanTieredPackagePrice.externalPriceId fixedPriceQuantity = newPlanTieredPackagePrice.fixedPriceQuantity invoiceGroupingKey = newPlanTieredPackagePrice.invoiceGroupingKey - cadence = newPlanTieredPackagePrice.cadence - billingCycleConfiguration = newPlanTieredPackagePrice.billingCycleConfiguration invoicingCycleConfiguration = newPlanTieredPackagePrice.invoicingCycleConfiguration - conversionRate = newPlanTieredPackagePrice.conversionRate - modelType = newPlanTieredPackagePrice.modelType - tieredPackageConfig = newPlanTieredPackagePrice.tieredPackageConfig - currency = newPlanTieredPackagePrice.currency + metadata = newPlanTieredPackagePrice.metadata additionalProperties = newPlanTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { + this.tieredPackageConfig = tieredPackageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration + invoicingCycleConfiguration: InvoicingCycleConfiguration? ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { - this.tieredPackageConfig = tieredPackageConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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 currency(currency: String) = apply { this.currency = currency } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10251,23 +11192,23 @@ constructor( fun build(): NewPlanTieredPackagePrice = NewPlanTieredPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredPackageConfig) { "`tieredPackageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -10880,69 +11821,65 @@ constructor( return true } - return /* spotless:off */ other is NewPlanTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageConfig == other.tieredPackageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageConfig=$tieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanTieredPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanTieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_minimum_config") + private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_minimum_config") - private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_minimum_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -10950,6 +11887,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -10960,16 +11919,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -10978,21 +11927,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_minimum_config") - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -11007,131 +11948,214 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanTieredWithMinimumPrice: NewPlanTieredWithMinimumPrice) = apply { - metadata = newPlanTieredWithMinimumPrice.metadata - externalPriceId = newPlanTieredWithMinimumPrice.externalPriceId + cadence = newPlanTieredWithMinimumPrice.cadence + itemId = newPlanTieredWithMinimumPrice.itemId + modelType = newPlanTieredWithMinimumPrice.modelType name = newPlanTieredWithMinimumPrice.name + tieredWithMinimumConfig = + newPlanTieredWithMinimumPrice.tieredWithMinimumConfig billableMetricId = newPlanTieredWithMinimumPrice.billableMetricId - itemId = newPlanTieredWithMinimumPrice.itemId billedInAdvance = newPlanTieredWithMinimumPrice.billedInAdvance - fixedPriceQuantity = newPlanTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTieredWithMinimumPrice.invoiceGroupingKey - cadence = newPlanTieredWithMinimumPrice.cadence billingCycleConfiguration = newPlanTieredWithMinimumPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanTieredWithMinimumPrice.invoicingCycleConfiguration conversionRate = newPlanTieredWithMinimumPrice.conversionRate - modelType = newPlanTieredWithMinimumPrice.modelType - tieredWithMinimumConfig = - newPlanTieredWithMinimumPrice.tieredWithMinimumConfig currency = newPlanTieredWithMinimumPrice.currency + externalPriceId = newPlanTieredWithMinimumPrice.externalPriceId + fixedPriceQuantity = newPlanTieredWithMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanTieredWithMinimumPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanTieredWithMinimumPrice.invoicingCycleConfiguration + metadata = newPlanTieredWithMinimumPrice.metadata additionalProperties = newPlanTieredWithMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + apply { + this.tieredWithMinimumConfig = tieredWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - apply { - this.tieredWithMinimumConfig = tieredWithMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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 currency(currency: String) = apply { this.currency = currency } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11157,23 +12181,23 @@ constructor( fun build(): NewPlanTieredWithMinimumPrice = NewPlanTieredWithMinimumPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithMinimumConfig) { "`tieredWithMinimumConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -11786,69 +12810,65 @@ constructor( return true } - return /* spotless:off */ other is NewPlanTieredWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithMinimumConfig=$tieredWithMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanTieredWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanUnitWithPercentPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_percent_config") + private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_percent_config") - private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_percent_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -11856,6 +12876,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -11866,16 +12908,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -11884,21 +12916,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_percent_config") - fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -11913,129 +12937,212 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithPercentConfig: UnitWithPercentConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithPercentConfig: UnitWithPercentConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(newPlanUnitWithPercentPrice: NewPlanUnitWithPercentPrice) = - apply { - metadata = newPlanUnitWithPercentPrice.metadata - externalPriceId = newPlanUnitWithPercentPrice.externalPriceId - name = newPlanUnitWithPercentPrice.name - billableMetricId = newPlanUnitWithPercentPrice.billableMetricId - itemId = newPlanUnitWithPercentPrice.itemId - billedInAdvance = newPlanUnitWithPercentPrice.billedInAdvance - fixedPriceQuantity = newPlanUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanUnitWithPercentPrice.invoiceGroupingKey - cadence = newPlanUnitWithPercentPrice.cadence - billingCycleConfiguration = - newPlanUnitWithPercentPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanUnitWithPercentPrice.invoicingCycleConfiguration - conversionRate = newPlanUnitWithPercentPrice.conversionRate - modelType = newPlanUnitWithPercentPrice.modelType - unitWithPercentConfig = newPlanUnitWithPercentPrice.unitWithPercentConfig - currency = newPlanUnitWithPercentPrice.currency - additionalProperties = - newPlanUnitWithPercentPrice.additionalProperties.toMutableMap() - } + @JvmSynthetic + internal fun from(newPlanUnitWithPercentPrice: NewPlanUnitWithPercentPrice) = + apply { + cadence = newPlanUnitWithPercentPrice.cadence + itemId = newPlanUnitWithPercentPrice.itemId + modelType = newPlanUnitWithPercentPrice.modelType + name = newPlanUnitWithPercentPrice.name + unitWithPercentConfig = newPlanUnitWithPercentPrice.unitWithPercentConfig + billableMetricId = newPlanUnitWithPercentPrice.billableMetricId + billedInAdvance = newPlanUnitWithPercentPrice.billedInAdvance + billingCycleConfiguration = + newPlanUnitWithPercentPrice.billingCycleConfiguration + conversionRate = newPlanUnitWithPercentPrice.conversionRate + currency = newPlanUnitWithPercentPrice.currency + externalPriceId = newPlanUnitWithPercentPrice.externalPriceId + fixedPriceQuantity = newPlanUnitWithPercentPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanUnitWithPercentPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanUnitWithPercentPrice.invoicingCycleConfiguration + metadata = newPlanUnitWithPercentPrice.metadata + additionalProperties = + newPlanUnitWithPercentPrice.additionalProperties.toMutableMap() + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + + /** The name of the price. */ + fun name(name: String) = apply { this.name = name } + + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = apply { + this.unitWithPercentConfig = unitWithPercentConfig + } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = apply { + this.billableMetricId = billableMetricId + } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) /** - * User-specified key/value pairs for the resource. Individual keys can be removed - * by setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } - /** The name of the price. */ - fun name(name: String) = apply { this.name = name } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) /** - * The id of the billable metric for the price. Only needed if the price is - * usage-based. + * If the Price represents a fixed cost, this represents the quantity of units + * applied. */ - fun billableMetricId(billableMetricId: String) = apply { - this.billableMetricId = billableMetricId + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this - * is true, and in-arrears if this is false. + * If the Price represents a fixed cost, this represents the quantity of units + * applied. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = apply { - this.unitWithPercentConfig = unitWithPercentConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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 currency(currency: String) = apply { this.currency = currency } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12061,23 +13168,23 @@ constructor( fun build(): NewPlanUnitWithPercentPrice = NewPlanUnitWithPercentPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithPercentConfig) { "`unitWithPercentConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -12690,69 +13797,66 @@ constructor( return true } - return /* spotless:off */ other is NewPlanUnitWithPercentPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithPercentConfig == other.unitWithPercentConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanUnitWithPercentPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithPercentConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanUnitWithPercentPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithPercentConfig=$unitWithPercentConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanUnitWithPercentPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanPackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_with_allocation_config") + private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_with_allocation_config") - private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_with_allocation_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -12760,6 +13864,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -12770,16 +13896,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -12788,22 +13904,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_with_allocation_config") - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -12818,131 +13925,214 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newPlanPackageWithAllocationPrice: NewPlanPackageWithAllocationPrice ) = apply { - metadata = newPlanPackageWithAllocationPrice.metadata - externalPriceId = newPlanPackageWithAllocationPrice.externalPriceId + cadence = newPlanPackageWithAllocationPrice.cadence + itemId = newPlanPackageWithAllocationPrice.itemId + modelType = newPlanPackageWithAllocationPrice.modelType name = newPlanPackageWithAllocationPrice.name + packageWithAllocationConfig = + newPlanPackageWithAllocationPrice.packageWithAllocationConfig billableMetricId = newPlanPackageWithAllocationPrice.billableMetricId - itemId = newPlanPackageWithAllocationPrice.itemId billedInAdvance = newPlanPackageWithAllocationPrice.billedInAdvance - fixedPriceQuantity = newPlanPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanPackageWithAllocationPrice.invoiceGroupingKey - cadence = newPlanPackageWithAllocationPrice.cadence billingCycleConfiguration = newPlanPackageWithAllocationPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanPackageWithAllocationPrice.invoicingCycleConfiguration conversionRate = newPlanPackageWithAllocationPrice.conversionRate - modelType = newPlanPackageWithAllocationPrice.modelType - packageWithAllocationConfig = - newPlanPackageWithAllocationPrice.packageWithAllocationConfig currency = newPlanPackageWithAllocationPrice.currency + externalPriceId = newPlanPackageWithAllocationPrice.externalPriceId + fixedPriceQuantity = newPlanPackageWithAllocationPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanPackageWithAllocationPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanPackageWithAllocationPrice.invoicingCycleConfiguration + metadata = newPlanPackageWithAllocationPrice.metadata additionalProperties = newPlanPackageWithAllocationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12968,23 +14158,23 @@ constructor( fun build(): NewPlanPackageWithAllocationPrice = NewPlanPackageWithAllocationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageWithAllocationConfig) { "`packageWithAllocationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -13598,69 +14788,65 @@ constructor( return true } - return /* spotless:off */ other is NewPlanPackageWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageWithAllocationConfig == other.packageWithAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanPackageWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageWithAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanPackageWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageWithAllocationConfig=$packageWithAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanPackageWithAllocationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanTierWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_proration_config") + private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_proration_config") - private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_proration_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = tieredWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -13668,6 +14854,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -13678,16 +14886,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -13696,21 +14894,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_proration_config") - fun tieredWithProrationConfig(): TieredWithProrationConfig = tieredWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -13725,130 +14915,213 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanTierWithProrationPrice: NewPlanTierWithProrationPrice) = apply { - metadata = newPlanTierWithProrationPrice.metadata - externalPriceId = newPlanTierWithProrationPrice.externalPriceId + cadence = newPlanTierWithProrationPrice.cadence + itemId = newPlanTierWithProrationPrice.itemId + modelType = newPlanTierWithProrationPrice.modelType name = newPlanTierWithProrationPrice.name + tieredWithProrationConfig = + newPlanTierWithProrationPrice.tieredWithProrationConfig billableMetricId = newPlanTierWithProrationPrice.billableMetricId - itemId = newPlanTierWithProrationPrice.itemId billedInAdvance = newPlanTierWithProrationPrice.billedInAdvance - fixedPriceQuantity = newPlanTierWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanTierWithProrationPrice.invoiceGroupingKey - cadence = newPlanTierWithProrationPrice.cadence billingCycleConfiguration = newPlanTierWithProrationPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanTierWithProrationPrice.invoicingCycleConfiguration conversionRate = newPlanTierWithProrationPrice.conversionRate - modelType = newPlanTierWithProrationPrice.modelType - tieredWithProrationConfig = - newPlanTierWithProrationPrice.tieredWithProrationConfig currency = newPlanTierWithProrationPrice.currency + externalPriceId = newPlanTierWithProrationPrice.externalPriceId + fixedPriceQuantity = newPlanTierWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanTierWithProrationPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanTierWithProrationPrice.invoicingCycleConfiguration + metadata = newPlanTierWithProrationPrice.metadata additionalProperties = newPlanTierWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithProrationConfig( + tieredWithProrationConfig: TieredWithProrationConfig + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun tieredWithProrationConfig( - tieredWithProrationConfig: TieredWithProrationConfig - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -13874,23 +15147,23 @@ constructor( fun build(): NewPlanTierWithProrationPrice = NewPlanTierWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithProrationConfig) { "`tieredWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -14504,69 +15777,65 @@ constructor( return true } - return /* spotless:off */ other is NewPlanTierWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithProrationConfig == other.tieredWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTierWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTierWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithProrationConfig=$tieredWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanTierWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanUnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_proration_config") + private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_proration_config") - private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -14574,6 +15843,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -14584,16 +15875,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -14602,21 +15883,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_proration_config") - fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -14631,131 +15904,214 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithProrationConfig: UnitWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithProrationConfig: UnitWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanUnitWithProrationPrice: NewPlanUnitWithProrationPrice) = apply { - metadata = newPlanUnitWithProrationPrice.metadata - externalPriceId = newPlanUnitWithProrationPrice.externalPriceId + cadence = newPlanUnitWithProrationPrice.cadence + itemId = newPlanUnitWithProrationPrice.itemId + modelType = newPlanUnitWithProrationPrice.modelType name = newPlanUnitWithProrationPrice.name + unitWithProrationConfig = + newPlanUnitWithProrationPrice.unitWithProrationConfig billableMetricId = newPlanUnitWithProrationPrice.billableMetricId - itemId = newPlanUnitWithProrationPrice.itemId billedInAdvance = newPlanUnitWithProrationPrice.billedInAdvance - fixedPriceQuantity = newPlanUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanUnitWithProrationPrice.invoiceGroupingKey - cadence = newPlanUnitWithProrationPrice.cadence billingCycleConfiguration = newPlanUnitWithProrationPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanUnitWithProrationPrice.invoicingCycleConfiguration conversionRate = newPlanUnitWithProrationPrice.conversionRate - modelType = newPlanUnitWithProrationPrice.modelType - unitWithProrationConfig = - newPlanUnitWithProrationPrice.unitWithProrationConfig currency = newPlanUnitWithProrationPrice.currency + externalPriceId = newPlanUnitWithProrationPrice.externalPriceId + fixedPriceQuantity = newPlanUnitWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanUnitWithProrationPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanUnitWithProrationPrice.invoicingCycleConfiguration + metadata = newPlanUnitWithProrationPrice.metadata additionalProperties = newPlanUnitWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + apply { + this.unitWithProrationConfig = unitWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - apply { - this.unitWithProrationConfig = unitWithProrationConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -14781,23 +16137,23 @@ constructor( fun build(): NewPlanUnitWithProrationPrice = NewPlanUnitWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithProrationConfig) { "`unitWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -15410,56 +16766,55 @@ constructor( return true } - return /* spotless:off */ other is NewPlanUnitWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithProrationConfig == other.unitWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanUnitWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanUnitWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithProrationConfig=$unitWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanUnitWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanGroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_allocation_config") + private val groupedAllocationConfig: GroupedAllocationConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_allocation_config") - private val groupedAllocationConfig: GroupedAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_allocation_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -15470,9 +16825,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -15480,6 +16832,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -15490,16 +16864,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -15508,21 +16872,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_allocation_config") - fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -15537,59 +16893,60 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null - private var name: String? = null - private var billableMetricId: String? = null - private var itemId: String? = null - private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null private var cadence: Cadence? = null + private var groupedAllocationConfig: GroupedAllocationConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null + private var name: String? = null + private var billableMetricId: String? = null + private var billedInAdvance: Boolean? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedAllocationConfig: GroupedAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanGroupedAllocationPrice: NewPlanGroupedAllocationPrice) = apply { - metadata = newPlanGroupedAllocationPrice.metadata - externalPriceId = newPlanGroupedAllocationPrice.externalPriceId + cadence = newPlanGroupedAllocationPrice.cadence + groupedAllocationConfig = + newPlanGroupedAllocationPrice.groupedAllocationConfig + itemId = newPlanGroupedAllocationPrice.itemId + modelType = newPlanGroupedAllocationPrice.modelType name = newPlanGroupedAllocationPrice.name billableMetricId = newPlanGroupedAllocationPrice.billableMetricId - itemId = newPlanGroupedAllocationPrice.itemId billedInAdvance = newPlanGroupedAllocationPrice.billedInAdvance - fixedPriceQuantity = newPlanGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedAllocationPrice.invoiceGroupingKey - cadence = newPlanGroupedAllocationPrice.cadence billingCycleConfiguration = newPlanGroupedAllocationPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanGroupedAllocationPrice.invoicingCycleConfiguration conversionRate = newPlanGroupedAllocationPrice.conversionRate - modelType = newPlanGroupedAllocationPrice.modelType - groupedAllocationConfig = - newPlanGroupedAllocationPrice.groupedAllocationConfig currency = newPlanGroupedAllocationPrice.currency + externalPriceId = newPlanGroupedAllocationPrice.externalPriceId + fixedPriceQuantity = newPlanGroupedAllocationPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanGroupedAllocationPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanGroupedAllocationPrice.invoicingCycleConfiguration + metadata = newPlanGroupedAllocationPrice.metadata additionalProperties = newPlanGroupedAllocationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + apply { + this.groupedAllocationConfig = groupedAllocationConfig + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -15598,70 +16955,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - apply { - this.groupedAllocationConfig = groupedAllocationConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -15687,23 +17126,23 @@ constructor( fun build(): NewPlanGroupedAllocationPrice = NewPlanGroupedAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedAllocationConfig) { + "`groupedAllocationConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedAllocationConfig) { - "`groupedAllocationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -16316,56 +17755,56 @@ constructor( return true } - return /* spotless:off */ other is NewPlanGroupedAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedAllocationConfig == other.groupedAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedAllocationPrice && cadence == other.cadence && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedAllocationConfig=$groupedAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanGroupedAllocationPrice{cadence=$cadence, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanGroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_with_prorated_minimum_config") + private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_prorated_minimum_config") - private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_with_prorated_minimum_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -16376,9 +17815,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -16386,19 +17822,6 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @JsonProperty("fixed_price_quantity") - fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** * For custom cadence: specifies the duration of the billing period in days or months. */ @@ -16406,30 +17829,46 @@ constructor( fun billingCycleConfiguration(): Optional = Optional.ofNullable(billingCycleConfiguration) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ @JsonProperty("conversion_rate") fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - @JsonProperty("model_type") fun modelType(): ModelType = modelType + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) - @JsonProperty("grouped_with_prorated_minimum_config") - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - @JsonProperty("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("invoicing_cycle_configuration") + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable(invoicingCycleConfiguration) + + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -16444,62 +17883,64 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig? = + null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig? = - null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newPlanGroupedWithProratedMinimumPrice: NewPlanGroupedWithProratedMinimumPrice ) = apply { - metadata = newPlanGroupedWithProratedMinimumPrice.metadata - externalPriceId = newPlanGroupedWithProratedMinimumPrice.externalPriceId + cadence = newPlanGroupedWithProratedMinimumPrice.cadence + groupedWithProratedMinimumConfig = + newPlanGroupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig + itemId = newPlanGroupedWithProratedMinimumPrice.itemId + modelType = newPlanGroupedWithProratedMinimumPrice.modelType name = newPlanGroupedWithProratedMinimumPrice.name billableMetricId = newPlanGroupedWithProratedMinimumPrice.billableMetricId - itemId = newPlanGroupedWithProratedMinimumPrice.itemId billedInAdvance = newPlanGroupedWithProratedMinimumPrice.billedInAdvance - fixedPriceQuantity = newPlanGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedWithProratedMinimumPrice.invoiceGroupingKey - cadence = newPlanGroupedWithProratedMinimumPrice.cadence billingCycleConfiguration = newPlanGroupedWithProratedMinimumPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanGroupedWithProratedMinimumPrice.invoicingCycleConfiguration conversionRate = newPlanGroupedWithProratedMinimumPrice.conversionRate - modelType = newPlanGroupedWithProratedMinimumPrice.modelType - groupedWithProratedMinimumConfig = - newPlanGroupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig currency = newPlanGroupedWithProratedMinimumPrice.currency + externalPriceId = newPlanGroupedWithProratedMinimumPrice.externalPriceId + fixedPriceQuantity = newPlanGroupedWithProratedMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanGroupedWithProratedMinimumPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanGroupedWithProratedMinimumPrice.invoicingCycleConfiguration + metadata = newPlanGroupedWithProratedMinimumPrice.metadata additionalProperties = newPlanGroupedWithProratedMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -16507,71 +17948,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { - this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16597,23 +18119,23 @@ constructor( fun build(): NewPlanGroupedWithProratedMinimumPrice = NewPlanGroupedWithProratedMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedWithProratedMinimumConfig) { + "`groupedWithProratedMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithProratedMinimumConfig) { - "`groupedWithProratedMinimumConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -17229,56 +18751,56 @@ constructor( return true } - return /* spotless:off */ other is NewPlanGroupedWithProratedMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedWithProratedMinimumPrice && cadence == other.cadence && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithProratedMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedWithProratedMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanGroupedWithProratedMinimumPrice{cadence=$cadence, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanGroupedWithMeteredMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_with_metered_minimum_config") + private val groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_metered_minimum_config") - private val groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_with_metered_minimum_config") + fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -17289,15 +18811,34 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - @JsonProperty("billed_in_advance") - fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + @JsonProperty("billed_in_advance") + fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) /** * If the Price represents a fixed cost, this represents the quantity of units applied. @@ -17309,16 +18850,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -17327,22 +18858,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_metered_minimum_config") - fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -17357,60 +18879,60 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newPlanGroupedWithMeteredMinimumPrice: NewPlanGroupedWithMeteredMinimumPrice ) = apply { - metadata = newPlanGroupedWithMeteredMinimumPrice.metadata - externalPriceId = newPlanGroupedWithMeteredMinimumPrice.externalPriceId + cadence = newPlanGroupedWithMeteredMinimumPrice.cadence + groupedWithMeteredMinimumConfig = + newPlanGroupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig + itemId = newPlanGroupedWithMeteredMinimumPrice.itemId + modelType = newPlanGroupedWithMeteredMinimumPrice.modelType name = newPlanGroupedWithMeteredMinimumPrice.name billableMetricId = newPlanGroupedWithMeteredMinimumPrice.billableMetricId - itemId = newPlanGroupedWithMeteredMinimumPrice.itemId billedInAdvance = newPlanGroupedWithMeteredMinimumPrice.billedInAdvance - fixedPriceQuantity = newPlanGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedWithMeteredMinimumPrice.invoiceGroupingKey - cadence = newPlanGroupedWithMeteredMinimumPrice.cadence billingCycleConfiguration = newPlanGroupedWithMeteredMinimumPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration conversionRate = newPlanGroupedWithMeteredMinimumPrice.conversionRate - modelType = newPlanGroupedWithMeteredMinimumPrice.modelType - groupedWithMeteredMinimumConfig = - newPlanGroupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig currency = newPlanGroupedWithMeteredMinimumPrice.currency + externalPriceId = newPlanGroupedWithMeteredMinimumPrice.externalPriceId + fixedPriceQuantity = newPlanGroupedWithMeteredMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanGroupedWithMeteredMinimumPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration + metadata = newPlanGroupedWithMeteredMinimumPrice.metadata additionalProperties = newPlanGroupedWithMeteredMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -17419,69 +18941,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -17507,23 +19112,23 @@ constructor( fun build(): NewPlanGroupedWithMeteredMinimumPrice = NewPlanGroupedWithMeteredMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedWithMeteredMinimumConfig) { + "`groupedWithMeteredMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithMeteredMinimumConfig) { - "`groupedWithMeteredMinimumConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -18138,56 +19743,56 @@ constructor( return true } - return /* spotless:off */ other is NewPlanGroupedWithMeteredMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedWithMeteredMinimumPrice && cadence == other.cadence && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithMeteredMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithMeteredMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedWithMeteredMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanGroupedWithMeteredMinimumPrice{cadence=$cadence, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanMatrixWithDisplayNamePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_with_display_name_config") + private val matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_with_display_name_config") - private val matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_with_display_name_config") + fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = + matrixWithDisplayNameConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -18198,9 +19803,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -18208,6 +19810,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -18218,16 +19842,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -18236,22 +19850,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_with_display_name_config") - fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = - matrixWithDisplayNameConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -18266,60 +19871,60 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newPlanMatrixWithDisplayNamePrice: NewPlanMatrixWithDisplayNamePrice ) = apply { - metadata = newPlanMatrixWithDisplayNamePrice.metadata - externalPriceId = newPlanMatrixWithDisplayNamePrice.externalPriceId + cadence = newPlanMatrixWithDisplayNamePrice.cadence + itemId = newPlanMatrixWithDisplayNamePrice.itemId + matrixWithDisplayNameConfig = + newPlanMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig + modelType = newPlanMatrixWithDisplayNamePrice.modelType name = newPlanMatrixWithDisplayNamePrice.name billableMetricId = newPlanMatrixWithDisplayNamePrice.billableMetricId - itemId = newPlanMatrixWithDisplayNamePrice.itemId billedInAdvance = newPlanMatrixWithDisplayNamePrice.billedInAdvance - fixedPriceQuantity = newPlanMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanMatrixWithDisplayNamePrice.invoiceGroupingKey - cadence = newPlanMatrixWithDisplayNamePrice.cadence billingCycleConfiguration = newPlanMatrixWithDisplayNamePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanMatrixWithDisplayNamePrice.invoicingCycleConfiguration conversionRate = newPlanMatrixWithDisplayNamePrice.conversionRate - modelType = newPlanMatrixWithDisplayNamePrice.modelType - matrixWithDisplayNameConfig = - newPlanMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig currency = newPlanMatrixWithDisplayNamePrice.currency + externalPriceId = newPlanMatrixWithDisplayNamePrice.externalPriceId + fixedPriceQuantity = newPlanMatrixWithDisplayNamePrice.fixedPriceQuantity + invoiceGroupingKey = newPlanMatrixWithDisplayNamePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanMatrixWithDisplayNamePrice.invoicingCycleConfiguration + metadata = newPlanMatrixWithDisplayNamePrice.metadata additionalProperties = newPlanMatrixWithDisplayNamePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig + ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -18328,69 +19933,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig - ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -18416,23 +20104,23 @@ constructor( fun build(): NewPlanMatrixWithDisplayNamePrice = NewPlanMatrixWithDisplayNamePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixWithDisplayNameConfig) { + "`matrixWithDisplayNameConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixWithDisplayNameConfig) { - "`matrixWithDisplayNameConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -19046,56 +20734,55 @@ constructor( return true } - return /* spotless:off */ other is NewPlanMatrixWithDisplayNamePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanMatrixWithDisplayNamePrice && cadence == other.cadence && itemId == other.itemId && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixWithDisplayNameConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixWithDisplayNameConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanMatrixWithDisplayNamePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanMatrixWithDisplayNamePrice{cadence=$cadence, itemId=$itemId, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanBulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_with_proration_config") + private val bulkWithProrationConfig: BulkWithProrationConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_with_proration_config") - private val bulkWithProrationConfig: BulkWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_with_proration_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -19106,9 +20793,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -19116,6 +20800,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -19126,16 +20832,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -19144,21 +20840,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_with_proration_config") - fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -19173,59 +20861,60 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkWithProrationConfig: BulkWithProrationConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkWithProrationConfig: BulkWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPlanBulkWithProrationPrice: NewPlanBulkWithProrationPrice) = apply { - metadata = newPlanBulkWithProrationPrice.metadata - externalPriceId = newPlanBulkWithProrationPrice.externalPriceId + bulkWithProrationConfig = + newPlanBulkWithProrationPrice.bulkWithProrationConfig + cadence = newPlanBulkWithProrationPrice.cadence + itemId = newPlanBulkWithProrationPrice.itemId + modelType = newPlanBulkWithProrationPrice.modelType name = newPlanBulkWithProrationPrice.name billableMetricId = newPlanBulkWithProrationPrice.billableMetricId - itemId = newPlanBulkWithProrationPrice.itemId billedInAdvance = newPlanBulkWithProrationPrice.billedInAdvance - fixedPriceQuantity = newPlanBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newPlanBulkWithProrationPrice.invoiceGroupingKey - cadence = newPlanBulkWithProrationPrice.cadence billingCycleConfiguration = newPlanBulkWithProrationPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanBulkWithProrationPrice.invoicingCycleConfiguration conversionRate = newPlanBulkWithProrationPrice.conversionRate - modelType = newPlanBulkWithProrationPrice.modelType - bulkWithProrationConfig = - newPlanBulkWithProrationPrice.bulkWithProrationConfig currency = newPlanBulkWithProrationPrice.currency + externalPriceId = newPlanBulkWithProrationPrice.externalPriceId + fixedPriceQuantity = newPlanBulkWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newPlanBulkWithProrationPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanBulkWithProrationPrice.invoicingCycleConfiguration + metadata = newPlanBulkWithProrationPrice.metadata additionalProperties = newPlanBulkWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + apply { + this.bulkWithProrationConfig = bulkWithProrationConfig + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -19234,70 +20923,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - apply { - this.bulkWithProrationConfig = bulkWithProrationConfig - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19323,23 +21094,23 @@ constructor( fun build(): NewPlanBulkWithProrationPrice = NewPlanBulkWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(bulkWithProrationConfig) { + "`bulkWithProrationConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkWithProrationConfig) { - "`bulkWithProrationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -19952,56 +21723,56 @@ constructor( return true } - return /* spotless:off */ other is NewPlanBulkWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkWithProrationConfig == other.bulkWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewPlanGroupedTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_tiered_package_config") + private val groupedTieredPackageConfig: GroupedTieredPackageConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_tiered_package_config") - private val groupedTieredPackageConfig: GroupedTieredPackageConfig, - @JsonProperty("currency") private val currency: String?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_tiered_package_config") + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -20012,9 +21783,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -20022,6 +21790,28 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ @@ -20032,16 +21822,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -20050,22 +21830,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_tiered_package_config") - fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = - groupedTieredPackageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this price - * is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -20080,60 +21851,60 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedTieredPackageConfig: GroupedTieredPackageConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedTieredPackageConfig: GroupedTieredPackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice ) = apply { - metadata = newPlanGroupedTieredPackagePrice.metadata - externalPriceId = newPlanGroupedTieredPackagePrice.externalPriceId + cadence = newPlanGroupedTieredPackagePrice.cadence + groupedTieredPackageConfig = + newPlanGroupedTieredPackagePrice.groupedTieredPackageConfig + itemId = newPlanGroupedTieredPackagePrice.itemId + modelType = newPlanGroupedTieredPackagePrice.modelType name = newPlanGroupedTieredPackagePrice.name billableMetricId = newPlanGroupedTieredPackagePrice.billableMetricId - itemId = newPlanGroupedTieredPackagePrice.itemId billedInAdvance = newPlanGroupedTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newPlanGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newPlanGroupedTieredPackagePrice.invoiceGroupingKey - cadence = newPlanGroupedTieredPackagePrice.cadence billingCycleConfiguration = newPlanGroupedTieredPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newPlanGroupedTieredPackagePrice.invoicingCycleConfiguration conversionRate = newPlanGroupedTieredPackagePrice.conversionRate - modelType = newPlanGroupedTieredPackagePrice.modelType - groupedTieredPackageConfig = - newPlanGroupedTieredPackagePrice.groupedTieredPackageConfig currency = newPlanGroupedTieredPackagePrice.currency + externalPriceId = newPlanGroupedTieredPackagePrice.externalPriceId + fixedPriceQuantity = newPlanGroupedTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newPlanGroupedTieredPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newPlanGroupedTieredPackagePrice.invoicingCycleConfiguration + metadata = newPlanGroupedTieredPackagePrice.metadata additionalProperties = newPlanGroupedTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: GroupedTieredPackageConfig + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -20142,69 +21913,152 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun groupedTieredPackageConfig( - groupedTieredPackageConfig: GroupedTieredPackageConfig - ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } /** * An ISO 4217 currency string, or custom pricing unit identifier, in which this * price is billed. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20230,23 +22084,23 @@ constructor( fun build(): NewPlanGroupedTieredPackagePrice = NewPlanGroupedTieredPackagePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedTieredPackageConfig) { + "`groupedTieredPackageConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedTieredPackageConfig) { - "`groupedTieredPackageConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -20860,17 +22714,17 @@ constructor( return true } - return /* spotless:off */ other is NewPlanGroupedTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedTieredPackageConfig == other.groupedTieredPackageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedTieredPackagePrice && cadence == other.cadence && groupedTieredPackageConfig == other.groupedTieredPackageConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredPackageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedTieredPackageConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredPackageConfig=$groupedTieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewPlanGroupedTieredPackagePrice{cadence=$cadence, groupedTieredPackageConfig=$groupedTieredPackageConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt index 07c783bc..48314c06 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt @@ -113,16 +113,31 @@ constructor( * alias for this Plan. Use this field to identify a plan by an existing identifier in * your system. */ - fun externalPlanId(externalPlanId: String) = apply { + fun externalPlanId(externalPlanId: String?) = apply { this.externalPlanId = externalPlanId } + /** + * An optional user-defined ID for this plan resource, used throughout the system as an + * alias for this Plan. Use this field to identify a plan by an existing identifier in + * your system. + */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -202,14 +217,29 @@ constructor( * alias for this Plan. Use this field to identify a plan by an existing identifier in your * system. */ - fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } + fun externalPlanId(externalPlanId: String?) = apply { body.externalPlanId(externalPlanId) } + + /** + * An optional user-defined ID for this plan resource, used throughout the system as an + * alias for this Plan. Use this field to identify a plan by an existing identifier in your + * system. + */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt index c84d0bae..5db830a7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt @@ -120,25 +120,53 @@ constructor( additionalQueryParams = planListParams.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 } + 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) = 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?) + + /** The plan status to filter to ('active', 'archived', or 'draft'). */ + fun status(status: Status?) = apply { this.status = status } /** The plan status to filter to ('active', 'archived', or 'draft'). */ - fun status(status: Status) = apply { this.status = status } + fun status(status: Optional) = status(status.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt index e29bb2d8..224fbc77 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt @@ -112,16 +112,31 @@ constructor( * alias for this Plan. Use this field to identify a plan by an existing identifier in * your system. */ - fun externalPlanId(externalPlanId: String) = apply { + fun externalPlanId(externalPlanId: String?) = apply { this.externalPlanId = externalPlanId } + /** + * An optional user-defined ID for this plan resource, used throughout the system as an + * alias for this Plan. Use this field to identify a plan by an existing identifier in + * your system. + */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -198,14 +213,29 @@ constructor( * alias for this Plan. Use this field to identify a plan by an existing identifier in your * system. */ - fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } + fun externalPlanId(externalPlanId: String?) = apply { body.externalPlanId(externalPlanId) } + + /** + * An optional user-defined ID for this plan resource, used throughout the system as an + * alias for this Plan. Use this field to identify a plan by an existing identifier in your + * system. + */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { body.metadata(metadata) } /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt index cab95d6b..50f89152 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt @@ -1003,70 +1003,70 @@ private constructor( class UnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("unit_config") @ExcludeMissing private val unitConfig: JsonField = JsonMissing.of(), @@ -1074,125 +1074,125 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun unitConfig(): UnitConfig = unitConfig.getRequired("unit_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun unitConfig(): UnitConfig = unitConfig.getRequired("unit_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("unit_config") @ExcludeMissing fun _unitConfig() = unitConfig @@ -1204,28 +1204,28 @@ private constructor( fun validate(): UnitPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() unitConfig().validate() validated = true } @@ -1240,97 +1240,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var unitConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(unitPrice: UnitPrice) = apply { - metadata = unitPrice.metadata id = unitPrice.id - name = unitPrice.name - externalPriceId = unitPrice.externalPriceId - priceType = unitPrice.priceType - modelType = unitPrice.modelType - createdAt = unitPrice.createdAt - cadence = unitPrice.cadence - billingCycleConfiguration = unitPrice.billingCycleConfiguration - invoicingCycleConfiguration = unitPrice.invoicingCycleConfiguration billableMetric = unitPrice.billableMetric - fixedPriceQuantity = unitPrice.fixedPriceQuantity - planPhaseOrder = unitPrice.planPhaseOrder - currency = unitPrice.currency + billingCycleConfiguration = unitPrice.billingCycleConfiguration + cadence = unitPrice.cadence conversionRate = unitPrice.conversionRate - item = unitPrice.item + createdAt = unitPrice.createdAt creditAllocation = unitPrice.creditAllocation + currency = unitPrice.currency discount = unitPrice.discount - minimum = unitPrice.minimum - minimumAmount = unitPrice.minimumAmount + externalPriceId = unitPrice.externalPriceId + fixedPriceQuantity = unitPrice.fixedPriceQuantity + invoicingCycleConfiguration = unitPrice.invoicingCycleConfiguration + item = unitPrice.item maximum = unitPrice.maximum maximumAmount = unitPrice.maximumAmount + metadata = unitPrice.metadata + minimum = unitPrice.minimum + minimumAmount = unitPrice.minimumAmount + modelType = unitPrice.modelType + name = unitPrice.name + planPhaseOrder = unitPrice.planPhaseOrder + priceType = unitPrice.priceType unitConfig = unitPrice.unitConfig additionalProperties = unitPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -1338,30 +1330,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -1371,37 +1359,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -1413,16 +1405,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun unitConfig(unitConfig: UnitConfig) = unitConfig(JsonField.of(unitConfig)) fun unitConfig(unitConfig: JsonField) = apply { @@ -1450,28 +1450,28 @@ private constructor( fun build(): UnitPrice = UnitPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, unitConfig, additionalProperties.toImmutable(), ) @@ -1828,24 +1828,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1854,8 +1854,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -1869,21 +1869,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -1891,6 +1887,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1915,8 +1915,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -1926,17 +1926,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2229,19 +2229,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -2250,7 +2247,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -2260,6 +2257,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2268,8 +2268,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -2283,26 +2283,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -2318,6 +2309,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2342,8 +2342,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -2353,17 +2353,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -2453,19 +2453,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -2474,7 +2471,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -2484,6 +2481,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2492,8 +2492,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -2507,26 +2507,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -2542,6 +2533,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2566,8 +2566,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -2577,17 +2577,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -2802,216 +2802,216 @@ private constructor( return true } - return /* spotless:off */ other is UnitPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && unitConfig == other.unitConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitConfig == other.unitConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UnitPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitConfig=$unitConfig, additionalProperties=$additionalProperties}" + "UnitPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitConfig=$unitConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class PackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), @JsonProperty("package_config") @ExcludeMissing private val packageConfig: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun packageConfig(): PackageConfig = packageConfig.getRequired("package_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun packageConfig(): PackageConfig = packageConfig.getRequired("package_config") - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun priceType(): PriceType = priceType.getRequired("price_type") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("package_config") @ExcludeMissing fun _packageConfig() = packageConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3020,29 +3020,29 @@ private constructor( fun validate(): PackagePrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() packageConfig().validate() + planPhaseOrder() + priceType() validated = true } } @@ -3056,97 +3056,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var packageConfig: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(packagePrice: PackagePrice) = apply { - metadata = packagePrice.metadata id = packagePrice.id - name = packagePrice.name - externalPriceId = packagePrice.externalPriceId - priceType = packagePrice.priceType - modelType = packagePrice.modelType - createdAt = packagePrice.createdAt - cadence = packagePrice.cadence - billingCycleConfiguration = packagePrice.billingCycleConfiguration - invoicingCycleConfiguration = packagePrice.invoicingCycleConfiguration billableMetric = packagePrice.billableMetric - fixedPriceQuantity = packagePrice.fixedPriceQuantity - planPhaseOrder = packagePrice.planPhaseOrder - currency = packagePrice.currency + billingCycleConfiguration = packagePrice.billingCycleConfiguration + cadence = packagePrice.cadence conversionRate = packagePrice.conversionRate - item = packagePrice.item + createdAt = packagePrice.createdAt creditAllocation = packagePrice.creditAllocation + currency = packagePrice.currency discount = packagePrice.discount - minimum = packagePrice.minimum - minimumAmount = packagePrice.minimumAmount + externalPriceId = packagePrice.externalPriceId + fixedPriceQuantity = packagePrice.fixedPriceQuantity + invoicingCycleConfiguration = packagePrice.invoicingCycleConfiguration + item = packagePrice.item maximum = packagePrice.maximum maximumAmount = packagePrice.maximumAmount + metadata = packagePrice.metadata + minimum = packagePrice.minimum + minimumAmount = packagePrice.minimumAmount + modelType = packagePrice.modelType + name = packagePrice.name packageConfig = packagePrice.packageConfig + planPhaseOrder = packagePrice.planPhaseOrder + priceType = packagePrice.priceType additionalProperties = packagePrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -3154,30 +3146,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -3187,37 +3175,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -3229,15 +3221,13 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + fun name(name: JsonField) = apply { this.name = name } fun packageConfig(packageConfig: PackageConfig) = packageConfig(JsonField.of(packageConfig)) @@ -3246,6 +3236,16 @@ private constructor( this.packageConfig = packageConfig } + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3267,29 +3267,29 @@ private constructor( fun build(): PackagePrice = PackagePrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, packageConfig, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -3645,24 +3645,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3671,8 +3671,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -3686,21 +3686,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -3708,6 +3704,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3732,8 +3732,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -3743,17 +3743,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -4046,19 +4046,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -4067,7 +4064,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -4077,6 +4074,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4085,8 +4085,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -4100,17 +4100,32 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** Maximum amount applied */ fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) @@ -4120,245 +4135,230 @@ private constructor( this.maximumAmount = maximumAmount } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Maximum = + Maximum( + appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + } + + /** + * 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`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class Minimum + @JsonCreator + private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. + */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + + /** Minimum amount applied */ + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. + */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Minimum = apply { + if (!validated) { + appliesToPriceIds() + minimumAmount() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(minimum: Minimum) = apply { + appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount + additionalProperties = minimum.additionalProperties.toMutableMap() + } + /** - * List of price_ids that this maximum amount applies to. For plan/plan phase - * maximums, this can be a subset of prices. + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) /** - * List of price_ids that this maximum amount applies to. For plan/plan phase - * maximums, this can be a subset of prices. - */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): Maximum = - Maximum( - maximumAmount, - appliesToPriceIds.map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" - } - - /** - * 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`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class Minimum - @JsonCreator - private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - - /** - * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, - * this can be a subset of prices. - */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - - /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - - /** - * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, - * this can be a subset of prices. - */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Minimum = apply { - if (!validated) { - minimumAmount() - appliesToPriceIds() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var minimumAmount: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount - appliesToPriceIds = minimum.appliesToPriceIds - additionalProperties = minimum.additionalProperties.toMutableMap() - } - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - - /** - * List of price_ids that this minimum amount applies to. For plan/plan phase - * minimums, this can be a subset of prices. - */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** - * List of price_ids that this minimum amount applies to. For plan/plan phase - * minimums, this can be a subset of prices. + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. */ fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4383,8 +4383,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -4394,17 +4394,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -4657,215 +4657,215 @@ private constructor( return true } - return /* spotless:off */ other is PackagePrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && packageConfig == other.packageConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackagePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, packageConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, packageConfig, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, packageConfig=$packageConfig, additionalProperties=$additionalProperties}" + "PackagePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, packageConfig=$packageConfig, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class MatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), + @JsonProperty("matrix_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val matrixConfig: JsonField = JsonMissing.of(), + @JsonProperty("maximum") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("matrix_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val matrixConfig: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") - - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig - @JsonProperty("item") @ExcludeMissing fun _item() = item + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -4875,29 +4875,29 @@ private constructor( fun validate(): MatrixPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() + matrixConfig().validate() maximum().map { it.validate() } maximumAmount() - matrixConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -4911,97 +4911,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() + private var matrixConfig: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var matrixConfig: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixPrice: MatrixPrice) = apply { - metadata = matrixPrice.metadata id = matrixPrice.id - name = matrixPrice.name - externalPriceId = matrixPrice.externalPriceId - priceType = matrixPrice.priceType - modelType = matrixPrice.modelType - createdAt = matrixPrice.createdAt - cadence = matrixPrice.cadence - billingCycleConfiguration = matrixPrice.billingCycleConfiguration - invoicingCycleConfiguration = matrixPrice.invoicingCycleConfiguration billableMetric = matrixPrice.billableMetric - fixedPriceQuantity = matrixPrice.fixedPriceQuantity - planPhaseOrder = matrixPrice.planPhaseOrder - currency = matrixPrice.currency + billingCycleConfiguration = matrixPrice.billingCycleConfiguration + cadence = matrixPrice.cadence conversionRate = matrixPrice.conversionRate - item = matrixPrice.item + createdAt = matrixPrice.createdAt creditAllocation = matrixPrice.creditAllocation + currency = matrixPrice.currency discount = matrixPrice.discount - minimum = matrixPrice.minimum - minimumAmount = matrixPrice.minimumAmount + externalPriceId = matrixPrice.externalPriceId + fixedPriceQuantity = matrixPrice.fixedPriceQuantity + invoicingCycleConfiguration = matrixPrice.invoicingCycleConfiguration + item = matrixPrice.item + matrixConfig = matrixPrice.matrixConfig maximum = matrixPrice.maximum maximumAmount = matrixPrice.maximumAmount - matrixConfig = matrixPrice.matrixConfig + metadata = matrixPrice.metadata + minimum = matrixPrice.minimum + minimumAmount = matrixPrice.minimumAmount + modelType = matrixPrice.modelType + name = matrixPrice.name + planPhaseOrder = matrixPrice.planPhaseOrder + priceType = matrixPrice.priceType additionalProperties = matrixPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -5009,30 +5001,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -5042,37 +5030,47 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun item(item: Item) = item(JsonField.of(item)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun item(item: JsonField) = apply { this.item = item } - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun matrixConfig(matrixConfig: MatrixConfig) = matrixConfig(JsonField.of(matrixConfig)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate + fun matrixConfig(matrixConfig: JsonField) = apply { + this.matrixConfig = matrixConfig } - fun item(item: Item) = item(JsonField.of(item)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun item(item: JsonField) = apply { this.item = item } + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -5084,22 +5082,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + fun name(name: JsonField) = apply { this.name = name } - fun matrixConfig(matrixConfig: MatrixConfig) = matrixConfig(JsonField.of(matrixConfig)) + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - fun matrixConfig(matrixConfig: JsonField) = apply { - this.matrixConfig = matrixConfig + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5121,29 +5121,29 @@ private constructor( fun build(): MatrixPrice = MatrixPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, + matrixConfig, maximum, maximumAmount, - matrixConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -5499,24 +5499,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5525,8 +5525,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -5540,21 +5540,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -5562,6 +5558,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5586,8 +5586,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -5597,17 +5597,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5900,12 +5900,12 @@ private constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") - @ExcludeMissing - private val dimensions: JsonField> = JsonMissing.of(), @JsonProperty("default_unit_amount") @ExcludeMissing private val defaultUnitAmount: JsonField = JsonMissing.of(), + @JsonProperty("dimensions") + @ExcludeMissing + private val dimensions: JsonField> = JsonMissing.of(), @JsonProperty("matrix_values") @ExcludeMissing private val matrixValues: JsonField> = JsonMissing.of(), @@ -5913,23 +5913,23 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(): List = dimensions.getRequired("dimensions") - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(): List = dimensions.getRequired("dimensions") + /** Matrix values for specified matrix grouping keys */ fun matrixValues(): List = matrixValues.getRequired("matrix_values") - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ @JsonProperty("default_unit_amount") @ExcludeMissing fun _defaultUnitAmount() = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") @ExcludeMissing fun _matrixValues() = matrixValues @@ -5941,8 +5941,8 @@ private constructor( fun validate(): MatrixConfig = apply { if (!validated) { - dimensions() defaultUnitAmount() + dimensions() matrixValues().forEach { it.validate() } validated = true } @@ -5957,27 +5957,19 @@ private constructor( class Builder { - private var dimensions: JsonField> = JsonMissing.of() private var defaultUnitAmount: JsonField = JsonMissing.of() + private var dimensions: JsonField> = JsonMissing.of() private var matrixValues: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions matrixValues = matrixConfig.matrixValues additionalProperties = matrixConfig.additionalProperties.toMutableMap() } - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: JsonField>) = apply { - this.dimensions = dimensions - } - /** * Default per unit rate for any usage not bucketed into a specified matrix_value */ @@ -5991,6 +5983,14 @@ private constructor( this.defaultUnitAmount = defaultUnitAmount } + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) + + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: JsonField>) = apply { + this.dimensions = dimensions + } + /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = matrixValues(JsonField.of(matrixValues)) @@ -6024,8 +6024,8 @@ private constructor( fun build(): MatrixConfig = MatrixConfig( - dimensions.map { it.toImmutable() }, defaultUnitAmount, + dimensions.map { it.toImmutable() }, matrixValues.map { it.toImmutable() }, additionalProperties.toImmutable(), ) @@ -6035,19 +6035,16 @@ private constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") - @ExcludeMissing - private val unitAmount: JsonField = JsonMissing.of(), @JsonProperty("dimension_values") @ExcludeMissing private val dimensionValues: JsonField> = JsonMissing.of(), + @JsonProperty("unit_amount") + @ExcludeMissing + private val unitAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and an @@ -6057,7 +6054,7 @@ private constructor( dimensionValues.getRequired("dimension_values") /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + fun unitAmount(): String = unitAmount.getRequired("unit_amount") /** * One or two matrix keys to filter usage to this Matrix value by. For example, @@ -6068,6 +6065,9 @@ private constructor( @ExcludeMissing fun _dimensionValues() = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6076,8 +6076,8 @@ private constructor( fun validate(): MatrixValue = apply { if (!validated) { - unitAmount() dimensionValues() + unitAmount() validated = true } } @@ -6091,25 +6091,17 @@ private constructor( class Builder { - private var unitAmount: JsonField = JsonMissing.of() private var dimensionValues: JsonField> = JsonMissing.of() + private var unitAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and @@ -6127,6 +6119,14 @@ private constructor( this.dimensionValues = dimensionValues } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6151,8 +6151,8 @@ private constructor( fun build(): MatrixValue = MatrixValue( - unitAmount, dimensionValues.map { it.toImmutable() }, + unitAmount, additionalProperties.toImmutable(), ) } @@ -6162,17 +6162,17 @@ private constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -6180,36 +6180,33 @@ private constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } @NoAutoDetect class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -6218,7 +6215,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -6228,6 +6225,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6236,8 +6236,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -6251,26 +6251,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -6286,6 +6277,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6310,8 +6310,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -6321,17 +6321,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -6421,19 +6421,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -6442,7 +6439,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -6452,6 +6449,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6460,8 +6460,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -6475,26 +6475,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -6510,6 +6501,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6534,8 +6534,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -6545,17 +6545,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -6671,213 +6671,213 @@ private constructor( return true } - return /* spotless:off */ other is MatrixPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && matrixConfig == other.matrixConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixConfig == other.matrixConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixConfig=$matrixConfig, additionalProperties=$additionalProperties}" + "MatrixPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixConfig=$matrixConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class TieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("tiered_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val tieredConfig: 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), + @JsonProperty("tiered_config") + @ExcludeMissing + private val tieredConfig: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun id(): String = id.getRequired("id") fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredConfig(): TieredConfig = tieredConfig.getRequired("tiered_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun tieredConfig(): TieredConfig = tieredConfig.getRequired("tiered_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("tiered_config") @ExcludeMissing fun _tieredConfig() = tieredConfig @@ -6889,28 +6889,28 @@ private constructor( fun validate(): TieredPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() tieredConfig().validate() validated = true } @@ -6925,97 +6925,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var tieredConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tieredPrice: TieredPrice) = apply { - metadata = tieredPrice.metadata id = tieredPrice.id - name = tieredPrice.name - externalPriceId = tieredPrice.externalPriceId - priceType = tieredPrice.priceType - modelType = tieredPrice.modelType - createdAt = tieredPrice.createdAt - cadence = tieredPrice.cadence - billingCycleConfiguration = tieredPrice.billingCycleConfiguration - invoicingCycleConfiguration = tieredPrice.invoicingCycleConfiguration billableMetric = tieredPrice.billableMetric - fixedPriceQuantity = tieredPrice.fixedPriceQuantity - planPhaseOrder = tieredPrice.planPhaseOrder - currency = tieredPrice.currency + billingCycleConfiguration = tieredPrice.billingCycleConfiguration + cadence = tieredPrice.cadence conversionRate = tieredPrice.conversionRate - item = tieredPrice.item + createdAt = tieredPrice.createdAt creditAllocation = tieredPrice.creditAllocation + currency = tieredPrice.currency discount = tieredPrice.discount - minimum = tieredPrice.minimum - minimumAmount = tieredPrice.minimumAmount + externalPriceId = tieredPrice.externalPriceId + fixedPriceQuantity = tieredPrice.fixedPriceQuantity + invoicingCycleConfiguration = tieredPrice.invoicingCycleConfiguration + item = tieredPrice.item maximum = tieredPrice.maximum maximumAmount = tieredPrice.maximumAmount + metadata = tieredPrice.metadata + minimum = tieredPrice.minimum + minimumAmount = tieredPrice.minimumAmount + modelType = tieredPrice.modelType + name = tieredPrice.name + planPhaseOrder = tieredPrice.planPhaseOrder + priceType = tieredPrice.priceType tieredConfig = tieredPrice.tieredConfig additionalProperties = tieredPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -7023,30 +7015,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -7056,37 +7044,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -7098,16 +7090,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun tieredConfig(tieredConfig: TieredConfig) = tieredConfig(JsonField.of(tieredConfig)) fun tieredConfig(tieredConfig: JsonField) = apply { @@ -7135,28 +7135,28 @@ private constructor( fun build(): TieredPrice = TieredPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, tieredConfig, additionalProperties.toImmutable(), ) @@ -7513,24 +7513,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7539,8 +7539,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -7554,21 +7554,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -7576,6 +7572,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -7600,8 +7600,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -7611,17 +7611,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -7914,19 +7914,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -7935,7 +7932,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -7945,6 +7942,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7953,8 +7953,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -7968,26 +7968,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -8003,6 +7994,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8027,8 +8027,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -8038,17 +8038,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -8138,19 +8138,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -8159,7 +8156,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -8169,6 +8166,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -8177,8 +8177,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -8192,26 +8192,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -8227,6 +8218,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8251,8 +8251,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -8262,17 +8262,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -8470,12 +8470,12 @@ private constructor( @JsonProperty("first_unit") @ExcludeMissing private val firstUnit: JsonField = JsonMissing.of(), - @JsonProperty("last_unit") - @ExcludeMissing - private val lastUnit: JsonField = JsonMissing.of(), @JsonProperty("unit_amount") @ExcludeMissing private val unitAmount: JsonField = JsonMissing.of(), + @JsonProperty("last_unit") + @ExcludeMissing + private val lastUnit: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -8483,22 +8483,22 @@ private constructor( /** Inclusive tier starting value */ fun firstUnit(): Double = firstUnit.getRequired("first_unit") + /** Amount per unit */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + /** Exclusive tier ending value. If null, this is treated as the last tier */ fun lastUnit(): Optional = Optional.ofNullable(lastUnit.getNullable("last_unit")) - /** Amount per unit */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - /** Inclusive tier starting value */ @JsonProperty("first_unit") @ExcludeMissing fun _firstUnit() = firstUnit - /** Exclusive tier ending value. If null, this is treated as the last tier */ - @JsonProperty("last_unit") @ExcludeMissing fun _lastUnit() = lastUnit - /** Amount per unit */ @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + /** Exclusive tier ending value. If null, this is treated as the last tier */ + @JsonProperty("last_unit") @ExcludeMissing fun _lastUnit() = lastUnit + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -8508,8 +8508,8 @@ private constructor( fun validate(): Tier = apply { if (!validated) { firstUnit() - lastUnit() unitAmount() + lastUnit() validated = true } } @@ -8524,15 +8524,15 @@ private constructor( class Builder { private var firstUnit: JsonField = JsonMissing.of() - private var lastUnit: JsonField = JsonMissing.of() private var unitAmount: JsonField = JsonMissing.of() + private var lastUnit: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } @@ -8544,12 +8544,6 @@ private constructor( this.firstUnit = firstUnit } - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: Double) = lastUnit(JsonField.of(lastUnit)) - - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: JsonField) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) @@ -8558,6 +8552,12 @@ private constructor( this.unitAmount = unitAmount } + /** Exclusive tier ending value. If null, this is treated as the last tier */ + fun lastUnit(lastUnit: Double) = lastUnit(JsonField.of(lastUnit)) + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + fun lastUnit(lastUnit: JsonField) = apply { this.lastUnit = lastUnit } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8583,8 +8583,8 @@ private constructor( fun build(): Tier = Tier( firstUnit, - lastUnit, unitAmount, + lastUnit, additionalProperties.toImmutable(), ) } @@ -8594,17 +8594,17 @@ private constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -8630,87 +8630,87 @@ private constructor( return true } - return /* spotless:off */ other is TieredPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && tieredConfig == other.tieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredConfig == other.tieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredConfig=$tieredConfig, additionalProperties=$additionalProperties}" + "TieredPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredConfig=$tieredConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class TieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("tiered_bps_config") @ExcludeMissing private val tieredBpsConfig: JsonField = JsonMissing.of(), @@ -8718,125 +8718,125 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig.getRequired("tiered_bps_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig.getRequired("tiered_bps_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("tiered_bps_config") @ExcludeMissing fun _tieredBpsConfig() = tieredBpsConfig @@ -8848,28 +8848,28 @@ private constructor( fun validate(): TieredBpsPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() tieredBpsConfig().validate() validated = true } @@ -8884,97 +8884,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var tieredBpsConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tieredBpsPrice: TieredBpsPrice) = apply { - metadata = tieredBpsPrice.metadata id = tieredBpsPrice.id - name = tieredBpsPrice.name - externalPriceId = tieredBpsPrice.externalPriceId - priceType = tieredBpsPrice.priceType - modelType = tieredBpsPrice.modelType - createdAt = tieredBpsPrice.createdAt - cadence = tieredBpsPrice.cadence - billingCycleConfiguration = tieredBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = tieredBpsPrice.invoicingCycleConfiguration billableMetric = tieredBpsPrice.billableMetric - fixedPriceQuantity = tieredBpsPrice.fixedPriceQuantity - planPhaseOrder = tieredBpsPrice.planPhaseOrder - currency = tieredBpsPrice.currency + billingCycleConfiguration = tieredBpsPrice.billingCycleConfiguration + cadence = tieredBpsPrice.cadence conversionRate = tieredBpsPrice.conversionRate - item = tieredBpsPrice.item + createdAt = tieredBpsPrice.createdAt creditAllocation = tieredBpsPrice.creditAllocation + currency = tieredBpsPrice.currency discount = tieredBpsPrice.discount - minimum = tieredBpsPrice.minimum - minimumAmount = tieredBpsPrice.minimumAmount + externalPriceId = tieredBpsPrice.externalPriceId + fixedPriceQuantity = tieredBpsPrice.fixedPriceQuantity + invoicingCycleConfiguration = tieredBpsPrice.invoicingCycleConfiguration + item = tieredBpsPrice.item maximum = tieredBpsPrice.maximum maximumAmount = tieredBpsPrice.maximumAmount + metadata = tieredBpsPrice.metadata + minimum = tieredBpsPrice.minimum + minimumAmount = tieredBpsPrice.minimumAmount + modelType = tieredBpsPrice.modelType + name = tieredBpsPrice.name + planPhaseOrder = tieredBpsPrice.planPhaseOrder + priceType = tieredBpsPrice.priceType tieredBpsConfig = tieredBpsPrice.tieredBpsConfig additionalProperties = tieredBpsPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -8982,30 +8974,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -9015,37 +9003,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -9057,16 +9049,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = tieredBpsConfig(JsonField.of(tieredBpsConfig)) @@ -9095,28 +9095,28 @@ private constructor( fun build(): TieredBpsPrice = TieredBpsPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, tieredBpsConfig, additionalProperties.toImmutable(), ) @@ -9473,24 +9473,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -9499,8 +9499,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -9514,21 +9514,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -9536,6 +9532,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -9560,8 +9560,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -9571,17 +9571,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -9874,19 +9874,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -9895,7 +9892,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -9905,6 +9902,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -9913,8 +9913,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -9928,26 +9928,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -9963,6 +9954,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -9987,8 +9987,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -9998,17 +9998,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -10098,19 +10098,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -10119,7 +10116,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -10129,6 +10126,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -10137,8 +10137,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -10152,26 +10152,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -10187,6 +10178,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -10211,8 +10211,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -10222,17 +10222,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -10440,15 +10440,15 @@ private constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") + @ExcludeMissing + private val bps: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("bps") - @ExcludeMissing - private val bps: JsonField = JsonMissing.of(), @JsonProperty("per_unit_maximum") @ExcludeMissing private val perUnitMaximum: JsonField = JsonMissing.of(), @@ -10456,6 +10456,9 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + fun bps(): Double = bps.getRequired("bps") + /** Inclusive tier starting value */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") @@ -10463,22 +10466,19 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - /** Per-event basis point rate */ - fun bps(): Double = bps.getRequired("bps") - /** Per unit maximum to charge */ fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) + /** Per-event basis point rate */ + @JsonProperty("bps") @ExcludeMissing fun _bps() = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount /** Exclusive tier ending value */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - /** Per-event basis point rate */ - @JsonProperty("bps") @ExcludeMissing fun _bps() = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") @ExcludeMissing @@ -10492,9 +10492,9 @@ private constructor( fun validate(): Tier = apply { if (!validated) { + bps() minimumAmount() maximumAmount() - bps() perUnitMaximum() validated = true } @@ -10509,21 +10509,27 @@ private constructor( class Builder { + private var bps: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bps: JsonField = JsonMissing.of() private var perUnitMaximum: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = bps(JsonField.of(bps)) + + /** Per-event basis point rate */ + fun bps(bps: JsonField) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) @@ -10542,12 +10548,6 @@ private constructor( this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = bps(JsonField.of(bps)) - - /** Per-event basis point rate */ - fun bps(bps: JsonField) = apply { this.bps = bps } - /** Per unit maximum to charge */ fun perUnitMaximum(perUnitMaximum: String) = perUnitMaximum(JsonField.of(perUnitMaximum)) @@ -10581,9 +10581,9 @@ private constructor( fun build(): Tier = Tier( + bps, minimumAmount, maximumAmount, - bps, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -10594,17 +10594,17 @@ private constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -10630,215 +10630,215 @@ private constructor( return true } - return /* spotless:off */ other is TieredBpsPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && tieredBpsConfig == other.tieredBpsConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredBpsPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredBpsConfig == other.tieredBpsConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredBpsConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredBpsConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredBpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredBpsConfig=$tieredBpsConfig, additionalProperties=$additionalProperties}" + "TieredBpsPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredBpsConfig=$tieredBpsConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class BpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("bps_config") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val bpsConfig: JsonField = JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("bps_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val bpsConfig: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun bpsConfig(): BpsConfig = bpsConfig.getRequired("bps_config") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bpsConfig(): BpsConfig = bpsConfig.getRequired("bps_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun name(): String = name.getRequired("name") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("bps_config") @ExcludeMissing fun _bpsConfig() = bpsConfig + + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("bps_config") @ExcludeMissing fun _bpsConfig() = bpsConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -10848,29 +10848,29 @@ private constructor( fun validate(): BpsPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + bpsConfig().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - bpsConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -10884,97 +10884,93 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var bpsConfig: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bpsConfig: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(bpsPrice: BpsPrice) = apply { - metadata = bpsPrice.metadata id = bpsPrice.id - name = bpsPrice.name - externalPriceId = bpsPrice.externalPriceId - priceType = bpsPrice.priceType - modelType = bpsPrice.modelType - createdAt = bpsPrice.createdAt - cadence = bpsPrice.cadence - billingCycleConfiguration = bpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = bpsPrice.invoicingCycleConfiguration billableMetric = bpsPrice.billableMetric - fixedPriceQuantity = bpsPrice.fixedPriceQuantity - planPhaseOrder = bpsPrice.planPhaseOrder - currency = bpsPrice.currency + billingCycleConfiguration = bpsPrice.billingCycleConfiguration + bpsConfig = bpsPrice.bpsConfig + cadence = bpsPrice.cadence conversionRate = bpsPrice.conversionRate - item = bpsPrice.item + createdAt = bpsPrice.createdAt creditAllocation = bpsPrice.creditAllocation + currency = bpsPrice.currency discount = bpsPrice.discount - minimum = bpsPrice.minimum - minimumAmount = bpsPrice.minimumAmount + externalPriceId = bpsPrice.externalPriceId + fixedPriceQuantity = bpsPrice.fixedPriceQuantity + invoicingCycleConfiguration = bpsPrice.invoicingCycleConfiguration + item = bpsPrice.item maximum = bpsPrice.maximum maximumAmount = bpsPrice.maximumAmount - bpsConfig = bpsPrice.bpsConfig + metadata = bpsPrice.metadata + minimum = bpsPrice.minimum + minimumAmount = bpsPrice.minimumAmount + modelType = bpsPrice.modelType + name = bpsPrice.name + planPhaseOrder = bpsPrice.planPhaseOrder + priceType = bpsPrice.priceType additionalProperties = bpsPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun bpsConfig(bpsConfig: JsonField) = apply { this.bpsConfig = bpsConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) + + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -10982,30 +10978,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -11015,37 +11007,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -11057,19 +11053,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun bpsConfig(bpsConfig: JsonField) = apply { this.bpsConfig = bpsConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11092,29 +11092,29 @@ private constructor( fun build(): BpsPrice = BpsPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + bpsConfig, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - bpsConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -11594,24 +11594,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -11620,8 +11620,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -11635,21 +11635,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -11657,6 +11653,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -11681,8 +11681,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -11692,17 +11692,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -11995,19 +11995,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -12016,7 +12013,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -12026,6 +12023,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -12034,8 +12034,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -12049,26 +12049,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -12084,6 +12075,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -12108,8 +12108,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -12119,17 +12119,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -12219,19 +12219,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -12240,7 +12237,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -12250,6 +12247,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -12258,8 +12258,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -12273,26 +12273,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -12308,6 +12299,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -12332,8 +12332,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -12343,17 +12343,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -12469,215 +12469,215 @@ private constructor( return true } - return /* spotless:off */ other is BpsPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && bpsConfig == other.bpsConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BpsPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bpsConfig == other.bpsConfig && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bpsConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bpsConfig, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bpsConfig=$bpsConfig, additionalProperties=$additionalProperties}" + "BpsPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bpsConfig=$bpsConfig, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class BulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("bulk_bps_config") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val bulkBpsConfig: JsonField = JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("bulk_bps_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") @ExcludeMissing - private val bulkBpsConfig: JsonField = JsonMissing.of(), + private val priceType: 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig.getRequired("bulk_bps_config") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig.getRequired("bulk_bps_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("bulk_bps_config") @ExcludeMissing fun _bulkBpsConfig() = bulkBpsConfig + + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("bulk_bps_config") @ExcludeMissing fun _bulkBpsConfig() = bulkBpsConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -12687,29 +12687,29 @@ private constructor( fun validate(): BulkBpsPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + bulkBpsConfig().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - bulkBpsConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -12723,97 +12723,96 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var bulkBpsConfig: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bulkBpsConfig: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(bulkBpsPrice: BulkBpsPrice) = apply { - metadata = bulkBpsPrice.metadata id = bulkBpsPrice.id - name = bulkBpsPrice.name - externalPriceId = bulkBpsPrice.externalPriceId - priceType = bulkBpsPrice.priceType - modelType = bulkBpsPrice.modelType - createdAt = bulkBpsPrice.createdAt - cadence = bulkBpsPrice.cadence - billingCycleConfiguration = bulkBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = bulkBpsPrice.invoicingCycleConfiguration billableMetric = bulkBpsPrice.billableMetric - fixedPriceQuantity = bulkBpsPrice.fixedPriceQuantity - planPhaseOrder = bulkBpsPrice.planPhaseOrder - currency = bulkBpsPrice.currency + billingCycleConfiguration = bulkBpsPrice.billingCycleConfiguration + bulkBpsConfig = bulkBpsPrice.bulkBpsConfig + cadence = bulkBpsPrice.cadence conversionRate = bulkBpsPrice.conversionRate - item = bulkBpsPrice.item + createdAt = bulkBpsPrice.createdAt creditAllocation = bulkBpsPrice.creditAllocation + currency = bulkBpsPrice.currency discount = bulkBpsPrice.discount - minimum = bulkBpsPrice.minimum - minimumAmount = bulkBpsPrice.minimumAmount + externalPriceId = bulkBpsPrice.externalPriceId + fixedPriceQuantity = bulkBpsPrice.fixedPriceQuantity + invoicingCycleConfiguration = bulkBpsPrice.invoicingCycleConfiguration + item = bulkBpsPrice.item maximum = bulkBpsPrice.maximum maximumAmount = bulkBpsPrice.maximumAmount - bulkBpsConfig = bulkBpsPrice.bulkBpsConfig + metadata = bulkBpsPrice.metadata + minimum = bulkBpsPrice.minimum + minimumAmount = bulkBpsPrice.minimumAmount + modelType = bulkBpsPrice.modelType + name = bulkBpsPrice.name + planPhaseOrder = bulkBpsPrice.planPhaseOrder + priceType = bulkBpsPrice.priceType additionalProperties = bulkBpsPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = + bulkBpsConfig(JsonField.of(bulkBpsConfig)) + + fun bulkBpsConfig(bulkBpsConfig: JsonField) = apply { + this.bulkBpsConfig = bulkBpsConfig } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -12821,30 +12820,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -12854,37 +12849,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -12896,23 +12895,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + fun name(name: JsonField) = apply { this.name = name } - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = - bulkBpsConfig(JsonField.of(bulkBpsConfig)) + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - fun bulkBpsConfig(bulkBpsConfig: JsonField) = apply { - this.bulkBpsConfig = bulkBpsConfig + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -12934,29 +12934,29 @@ private constructor( fun build(): BulkBpsPrice = BulkBpsPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + bulkBpsConfig, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - bulkBpsConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -13326,12 +13326,12 @@ private constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("bps") @ExcludeMissing private val bps: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("per_unit_maximum") @ExcludeMissing private val perUnitMaximum: JsonField = JsonMissing.of(), @@ -13339,23 +13339,23 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + fun bps(): Double = bps.getRequired("bps") + /** Upper bound for tier */ fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - /** Basis points to rate on */ - fun bps(): Double = bps.getRequired("bps") - /** The maximum amount to charge for any one event */ fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) - /** Upper bound for tier */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - /** Basis points to rate on */ @JsonProperty("bps") @ExcludeMissing fun _bps() = bps + /** Upper bound for tier */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") @ExcludeMissing @@ -13369,8 +13369,8 @@ private constructor( fun validate(): Tier = apply { if (!validated) { - maximumAmount() bps() + maximumAmount() perUnitMaximum() validated = true } @@ -13385,19 +13385,25 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var bps: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var perUnitMaximum: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = bps(JsonField.of(bps)) + + /** Basis points to rate on */ + fun bps(bps: JsonField) = apply { this.bps = bps } + /** Upper bound for tier */ fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) @@ -13407,12 +13413,6 @@ private constructor( this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = bps(JsonField.of(bps)) - - /** Basis points to rate on */ - fun bps(bps: JsonField) = apply { this.bps = bps } - /** The maximum amount to charge for any one event */ fun perUnitMaximum(perUnitMaximum: String) = perUnitMaximum(JsonField.of(perUnitMaximum)) @@ -13446,8 +13446,8 @@ private constructor( fun build(): Tier = Tier( - maximumAmount, bps, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -13458,17 +13458,17 @@ private constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -13574,24 +13574,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -13600,8 +13600,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -13615,21 +13615,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -13637,6 +13633,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -13661,8 +13661,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -13672,17 +13672,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -13975,19 +13975,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -13996,7 +13993,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -14006,6 +14003,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -14014,8 +14014,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -14029,26 +14029,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -14064,6 +14055,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -14088,8 +14088,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -14099,17 +14099,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -14198,20 +14198,17 @@ private constructor( @NoAutoDetect class Minimum @JsonCreator - private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -14220,7 +14217,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -14230,6 +14227,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -14238,8 +14238,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -14253,26 +14253,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -14288,6 +14279,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -14312,8 +14312,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -14323,17 +14323,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -14449,215 +14449,215 @@ private constructor( return true } - return /* spotless:off */ other is BulkBpsPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && bulkBpsConfig == other.bulkBpsConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkBpsPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkBpsConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkBpsConfig, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BulkBpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkBpsConfig=$bulkBpsConfig, additionalProperties=$additionalProperties}" + "BulkBpsPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class BulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("bulk_config") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val bulkConfig: JsonField = JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("bulk_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val bulkConfig: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun bulkConfig(): BulkConfig = bulkConfig.getRequired("bulk_config") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bulkConfig(): BulkConfig = bulkConfig.getRequired("bulk_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("bulk_config") @ExcludeMissing fun _bulkConfig() = bulkConfig + + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("bulk_config") @ExcludeMissing fun _bulkConfig() = bulkConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -14667,29 +14667,29 @@ private constructor( fun validate(): BulkPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + bulkConfig().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - bulkConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -14703,97 +14703,95 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var bulkConfig: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bulkConfig: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(bulkPrice: BulkPrice) = apply { - metadata = bulkPrice.metadata id = bulkPrice.id - name = bulkPrice.name - externalPriceId = bulkPrice.externalPriceId - priceType = bulkPrice.priceType - modelType = bulkPrice.modelType - createdAt = bulkPrice.createdAt - cadence = bulkPrice.cadence - billingCycleConfiguration = bulkPrice.billingCycleConfiguration - invoicingCycleConfiguration = bulkPrice.invoicingCycleConfiguration billableMetric = bulkPrice.billableMetric - fixedPriceQuantity = bulkPrice.fixedPriceQuantity - planPhaseOrder = bulkPrice.planPhaseOrder - currency = bulkPrice.currency + billingCycleConfiguration = bulkPrice.billingCycleConfiguration + bulkConfig = bulkPrice.bulkConfig + cadence = bulkPrice.cadence conversionRate = bulkPrice.conversionRate - item = bulkPrice.item + createdAt = bulkPrice.createdAt creditAllocation = bulkPrice.creditAllocation + currency = bulkPrice.currency discount = bulkPrice.discount - minimum = bulkPrice.minimum - minimumAmount = bulkPrice.minimumAmount + externalPriceId = bulkPrice.externalPriceId + fixedPriceQuantity = bulkPrice.fixedPriceQuantity + invoicingCycleConfiguration = bulkPrice.invoicingCycleConfiguration + item = bulkPrice.item maximum = bulkPrice.maximum maximumAmount = bulkPrice.maximumAmount - bulkConfig = bulkPrice.bulkConfig + metadata = bulkPrice.metadata + minimum = bulkPrice.minimum + minimumAmount = bulkPrice.minimumAmount + modelType = bulkPrice.modelType + name = bulkPrice.name + planPhaseOrder = bulkPrice.planPhaseOrder + priceType = bulkPrice.priceType additionalProperties = bulkPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) + + fun bulkConfig(bulkConfig: JsonField) = apply { + this.bulkConfig = bulkConfig } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -14801,30 +14799,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -14834,37 +14828,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -14876,22 +14874,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + fun name(name: JsonField) = apply { this.name = name } - fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - fun bulkConfig(bulkConfig: JsonField) = apply { - this.bulkConfig = bulkConfig + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -14913,29 +14913,29 @@ private constructor( fun build(): BulkPrice = BulkPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + bulkConfig, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - bulkConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -15290,29 +15290,29 @@ private constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") - @ExcludeMissing - private val maximumUnits: JsonField = JsonMissing.of(), @JsonProperty("unit_amount") @ExcludeMissing private val unitAmount: JsonField = JsonMissing.of(), + @JsonProperty("maximum_units") + @ExcludeMissing + private val maximumUnits: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + /** Upper bound for this tier */ fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits.getNullable("maximum_units")) /** Amount per unit */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount /** Upper bound for this tier */ @JsonProperty("maximum_units") @ExcludeMissing fun _maximumUnits() = maximumUnits - /** Amount per unit */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -15321,8 +15321,8 @@ private constructor( fun validate(): Tier = apply { if (!validated) { - maximumUnits() unitAmount() + maximumUnits() validated = true } } @@ -15336,17 +15336,25 @@ private constructor( class Builder { - private var maximumUnits: JsonField = JsonMissing.of() private var unitAmount: JsonField = JsonMissing.of() + private var maximumUnits: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Amount per unit */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + /** Upper bound for this tier */ fun maximumUnits(maximumUnits: Double) = maximumUnits(JsonField.of(maximumUnits)) @@ -15356,14 +15364,6 @@ private constructor( this.maximumUnits = maximumUnits } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Amount per unit */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -15388,8 +15388,8 @@ private constructor( fun build(): Tier = Tier( - maximumUnits, unitAmount, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -15399,17 +15399,17 @@ private constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -15515,24 +15515,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -15541,8 +15541,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -15556,21 +15556,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -15578,6 +15574,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -15602,8 +15602,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -15613,17 +15613,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -15916,19 +15916,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -15937,7 +15934,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -15947,6 +15944,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -15955,8 +15955,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -15970,26 +15970,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -16005,6 +15996,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -16029,8 +16029,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -16040,17 +16040,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -16140,19 +16140,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -16161,7 +16158,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -16171,6 +16168,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -16179,8 +16179,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -16194,26 +16194,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -16229,6 +16220,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -16253,8 +16253,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -16264,17 +16264,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -16390,87 +16390,87 @@ private constructor( return true } - return /* spotless:off */ other is BulkPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && bulkConfig == other.bulkConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkConfig == other.bulkConfig && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkConfig, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BulkPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkConfig=$bulkConfig, additionalProperties=$additionalProperties}" + "BulkPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkConfig=$bulkConfig, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class ThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("threshold_total_amount_config") @ExcludeMissing private val thresholdTotalAmountConfig: JsonField = @@ -16479,126 +16479,126 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig.getRequired("threshold_total_amount_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig.getRequired("threshold_total_amount_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("threshold_total_amount_config") @ExcludeMissing @@ -16612,28 +16612,28 @@ private constructor( fun validate(): ThresholdTotalAmountPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() thresholdTotalAmountConfig().validate() validated = true } @@ -16648,98 +16648,90 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var thresholdTotalAmountConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(thresholdTotalAmountPrice: ThresholdTotalAmountPrice) = apply { - metadata = thresholdTotalAmountPrice.metadata id = thresholdTotalAmountPrice.id - name = thresholdTotalAmountPrice.name - externalPriceId = thresholdTotalAmountPrice.externalPriceId - priceType = thresholdTotalAmountPrice.priceType - modelType = thresholdTotalAmountPrice.modelType - createdAt = thresholdTotalAmountPrice.createdAt - cadence = thresholdTotalAmountPrice.cadence - billingCycleConfiguration = thresholdTotalAmountPrice.billingCycleConfiguration - invoicingCycleConfiguration = thresholdTotalAmountPrice.invoicingCycleConfiguration billableMetric = thresholdTotalAmountPrice.billableMetric - fixedPriceQuantity = thresholdTotalAmountPrice.fixedPriceQuantity - planPhaseOrder = thresholdTotalAmountPrice.planPhaseOrder - currency = thresholdTotalAmountPrice.currency + billingCycleConfiguration = thresholdTotalAmountPrice.billingCycleConfiguration + cadence = thresholdTotalAmountPrice.cadence conversionRate = thresholdTotalAmountPrice.conversionRate - item = thresholdTotalAmountPrice.item + createdAt = thresholdTotalAmountPrice.createdAt creditAllocation = thresholdTotalAmountPrice.creditAllocation + currency = thresholdTotalAmountPrice.currency discount = thresholdTotalAmountPrice.discount - minimum = thresholdTotalAmountPrice.minimum - minimumAmount = thresholdTotalAmountPrice.minimumAmount + externalPriceId = thresholdTotalAmountPrice.externalPriceId + fixedPriceQuantity = thresholdTotalAmountPrice.fixedPriceQuantity + invoicingCycleConfiguration = thresholdTotalAmountPrice.invoicingCycleConfiguration + item = thresholdTotalAmountPrice.item maximum = thresholdTotalAmountPrice.maximum maximumAmount = thresholdTotalAmountPrice.maximumAmount + metadata = thresholdTotalAmountPrice.metadata + minimum = thresholdTotalAmountPrice.minimum + minimumAmount = thresholdTotalAmountPrice.minimumAmount + modelType = thresholdTotalAmountPrice.modelType + name = thresholdTotalAmountPrice.name + planPhaseOrder = thresholdTotalAmountPrice.planPhaseOrder + priceType = thresholdTotalAmountPrice.priceType thresholdTotalAmountConfig = thresholdTotalAmountPrice.thresholdTotalAmountConfig additionalProperties = thresholdTotalAmountPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -16747,30 +16739,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -16780,37 +16768,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -16822,16 +16814,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun thresholdTotalAmountConfig(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = thresholdTotalAmountConfig(JsonField.of(thresholdTotalAmountConfig)) @@ -16860,28 +16860,28 @@ private constructor( fun build(): ThresholdTotalAmountPrice = ThresholdTotalAmountPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, thresholdTotalAmountConfig, additionalProperties.toImmutable(), ) @@ -17238,24 +17238,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -17264,8 +17264,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -17279,21 +17279,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -17301,6 +17297,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -17325,8 +17325,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -17336,17 +17336,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -17639,19 +17639,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -17660,7 +17657,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -17670,6 +17667,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -17678,8 +17678,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -17693,26 +17693,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -17728,6 +17719,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -17752,8 +17752,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -17763,17 +17763,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -17863,19 +17863,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -17884,7 +17881,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -17894,6 +17891,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -17902,8 +17902,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -17917,26 +17917,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -17952,6 +17943,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -17976,8 +17976,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -17987,17 +17987,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -18194,87 +18194,87 @@ private constructor( return true } - return /* spotless:off */ other is ThresholdTotalAmountPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ThresholdTotalAmountPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, thresholdTotalAmountConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, thresholdTotalAmountConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ThresholdTotalAmountPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, additionalProperties=$additionalProperties}" + "ThresholdTotalAmountPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class TieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("tiered_package_config") @ExcludeMissing private val tieredPackageConfig: JsonField = JsonMissing.of(), @@ -18282,126 +18282,126 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredPackageConfig(): TieredPackageConfig = - tieredPackageConfig.getRequired("tiered_package_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun tieredPackageConfig(): TieredPackageConfig = + tieredPackageConfig.getRequired("tiered_package_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("tiered_package_config") @ExcludeMissing @@ -18415,28 +18415,28 @@ private constructor( fun validate(): TieredPackagePrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() tieredPackageConfig().validate() validated = true } @@ -18451,97 +18451,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var tieredPackageConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tieredPackagePrice: TieredPackagePrice) = apply { - metadata = tieredPackagePrice.metadata id = tieredPackagePrice.id - name = tieredPackagePrice.name - externalPriceId = tieredPackagePrice.externalPriceId - priceType = tieredPackagePrice.priceType - modelType = tieredPackagePrice.modelType - createdAt = tieredPackagePrice.createdAt - cadence = tieredPackagePrice.cadence - billingCycleConfiguration = tieredPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = tieredPackagePrice.invoicingCycleConfiguration billableMetric = tieredPackagePrice.billableMetric - fixedPriceQuantity = tieredPackagePrice.fixedPriceQuantity - planPhaseOrder = tieredPackagePrice.planPhaseOrder - currency = tieredPackagePrice.currency + billingCycleConfiguration = tieredPackagePrice.billingCycleConfiguration + cadence = tieredPackagePrice.cadence conversionRate = tieredPackagePrice.conversionRate - item = tieredPackagePrice.item + createdAt = tieredPackagePrice.createdAt creditAllocation = tieredPackagePrice.creditAllocation + currency = tieredPackagePrice.currency discount = tieredPackagePrice.discount - minimum = tieredPackagePrice.minimum - minimumAmount = tieredPackagePrice.minimumAmount + externalPriceId = tieredPackagePrice.externalPriceId + fixedPriceQuantity = tieredPackagePrice.fixedPriceQuantity + invoicingCycleConfiguration = tieredPackagePrice.invoicingCycleConfiguration + item = tieredPackagePrice.item maximum = tieredPackagePrice.maximum maximumAmount = tieredPackagePrice.maximumAmount + metadata = tieredPackagePrice.metadata + minimum = tieredPackagePrice.minimum + minimumAmount = tieredPackagePrice.minimumAmount + modelType = tieredPackagePrice.modelType + name = tieredPackagePrice.name + planPhaseOrder = tieredPackagePrice.planPhaseOrder + priceType = tieredPackagePrice.priceType tieredPackageConfig = tieredPackagePrice.tieredPackageConfig additionalProperties = tieredPackagePrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -18549,30 +18541,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -18582,37 +18570,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -18624,16 +18616,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = tieredPackageConfig(JsonField.of(tieredPackageConfig)) @@ -18662,28 +18662,28 @@ private constructor( fun build(): TieredPackagePrice = TieredPackagePrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, tieredPackageConfig, additionalProperties.toImmutable(), ) @@ -19040,24 +19040,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -19066,8 +19066,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -19081,21 +19081,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -19103,6 +19099,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -19127,8 +19127,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -19138,17 +19138,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -19441,19 +19441,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -19462,7 +19459,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -19472,6 +19469,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -19480,8 +19480,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -19495,26 +19495,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -19530,6 +19521,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -19554,8 +19554,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -19565,17 +19565,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -19665,19 +19665,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -19686,7 +19683,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -19696,6 +19693,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -19704,8 +19704,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -19719,26 +19719,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -19754,6 +19745,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -19778,8 +19778,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -19789,17 +19789,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -19995,218 +19995,218 @@ private constructor( return true } - return /* spotless:off */ other is TieredPackagePrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && tieredPackageConfig == other.tieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackagePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredPackageConfig == other.tieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredPackageConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredPackageConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredPackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredPackageConfig=$tieredPackageConfig, additionalProperties=$additionalProperties}" + "TieredPackagePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredPackageConfig=$tieredPackageConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class GroupedTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + @JsonProperty("grouped_tiered_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val groupedTieredConfig: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("grouped_tiered_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val groupedTieredConfig: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") + fun groupedTieredConfig(): GroupedTieredConfig = + groupedTieredConfig.getRequired("grouped_tiered_config") - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedTieredConfig(): GroupedTieredConfig = - groupedTieredConfig.getRequired("grouped_tiered_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("grouped_tiered_config") + @ExcludeMissing + fun _groupedTieredConfig() = groupedTieredConfig - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("grouped_tiered_config") - @ExcludeMissing - fun _groupedTieredConfig() = groupedTieredConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -20216,29 +20216,29 @@ private constructor( fun validate(): GroupedTieredPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + groupedTieredConfig().validate() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - groupedTieredConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -20252,97 +20252,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var groupedTieredConfig: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var groupedTieredConfig: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(groupedTieredPrice: GroupedTieredPrice) = apply { - metadata = groupedTieredPrice.metadata id = groupedTieredPrice.id - name = groupedTieredPrice.name - externalPriceId = groupedTieredPrice.externalPriceId - priceType = groupedTieredPrice.priceType - modelType = groupedTieredPrice.modelType - createdAt = groupedTieredPrice.createdAt - cadence = groupedTieredPrice.cadence - billingCycleConfiguration = groupedTieredPrice.billingCycleConfiguration - invoicingCycleConfiguration = groupedTieredPrice.invoicingCycleConfiguration billableMetric = groupedTieredPrice.billableMetric - fixedPriceQuantity = groupedTieredPrice.fixedPriceQuantity - planPhaseOrder = groupedTieredPrice.planPhaseOrder - currency = groupedTieredPrice.currency + billingCycleConfiguration = groupedTieredPrice.billingCycleConfiguration + cadence = groupedTieredPrice.cadence conversionRate = groupedTieredPrice.conversionRate - item = groupedTieredPrice.item + createdAt = groupedTieredPrice.createdAt creditAllocation = groupedTieredPrice.creditAllocation + currency = groupedTieredPrice.currency discount = groupedTieredPrice.discount - minimum = groupedTieredPrice.minimum - minimumAmount = groupedTieredPrice.minimumAmount + externalPriceId = groupedTieredPrice.externalPriceId + fixedPriceQuantity = groupedTieredPrice.fixedPriceQuantity + groupedTieredConfig = groupedTieredPrice.groupedTieredConfig + invoicingCycleConfiguration = groupedTieredPrice.invoicingCycleConfiguration + item = groupedTieredPrice.item maximum = groupedTieredPrice.maximum maximumAmount = groupedTieredPrice.maximumAmount - groupedTieredConfig = groupedTieredPrice.groupedTieredConfig + metadata = groupedTieredPrice.metadata + minimum = groupedTieredPrice.minimum + minimumAmount = groupedTieredPrice.minimumAmount + modelType = groupedTieredPrice.modelType + name = groupedTieredPrice.name + planPhaseOrder = groupedTieredPrice.planPhaseOrder + priceType = groupedTieredPrice.priceType additionalProperties = groupedTieredPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -20350,30 +20342,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -20383,37 +20371,48 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = + groupedTieredConfig(JsonField.of(groupedTieredConfig)) - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun groupedTieredConfig(groupedTieredConfig: JsonField) = apply { + this.groupedTieredConfig = groupedTieredConfig } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -20425,23 +20424,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + fun name(name: JsonField) = apply { this.name = name } - fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = - groupedTieredConfig(JsonField.of(groupedTieredConfig)) + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - fun groupedTieredConfig(groupedTieredConfig: JsonField) = apply { - this.groupedTieredConfig = groupedTieredConfig + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -20463,29 +20463,29 @@ private constructor( fun build(): GroupedTieredPrice = GroupedTieredPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + groupedTieredConfig, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - groupedTieredConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -20841,24 +20841,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -20867,8 +20867,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -20882,21 +20882,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -20904,6 +20900,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -20928,8 +20928,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -20939,17 +20939,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -21322,19 +21322,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -21343,7 +21340,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -21353,6 +21350,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -21361,8 +21361,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -21376,24 +21376,15 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount - appliesToPriceIds = maximum.appliesToPriceIds - additionalProperties = maximum.additionalProperties.toMutableMap() - } - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount + additionalProperties = maximum.additionalProperties.toMutableMap() } /** @@ -21411,6 +21402,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -21435,8 +21435,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -21446,17 +21446,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -21546,19 +21546,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -21567,7 +21564,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -21577,6 +21574,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -21585,8 +21585,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -21600,26 +21600,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -21635,6 +21626,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -21659,8 +21659,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -21670,17 +21670,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -21796,87 +21796,87 @@ private constructor( return true } - return /* spotless:off */ other is GroupedTieredPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && groupedTieredConfig == other.groupedTieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredConfig == other.groupedTieredConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedTieredConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedTieredPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedTieredConfig=$groupedTieredConfig, additionalProperties=$additionalProperties}" + "GroupedTieredPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredConfig=$groupedTieredConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class TieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_minimum_config") @ExcludeMissing private val tieredWithMinimumConfig: JsonField = JsonMissing.of(), @@ -21884,126 +21884,126 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = - tieredWithMinimumConfig.getRequired("tiered_with_minimum_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = + tieredWithMinimumConfig.getRequired("tiered_with_minimum_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("tiered_with_minimum_config") @ExcludeMissing @@ -22017,28 +22017,28 @@ private constructor( fun validate(): TieredWithMinimumPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() tieredWithMinimumConfig().validate() validated = true } @@ -22053,98 +22053,90 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var tieredWithMinimumConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tieredWithMinimumPrice: TieredWithMinimumPrice) = apply { - metadata = tieredWithMinimumPrice.metadata id = tieredWithMinimumPrice.id - name = tieredWithMinimumPrice.name - externalPriceId = tieredWithMinimumPrice.externalPriceId - priceType = tieredWithMinimumPrice.priceType - modelType = tieredWithMinimumPrice.modelType - createdAt = tieredWithMinimumPrice.createdAt - cadence = tieredWithMinimumPrice.cadence - billingCycleConfiguration = tieredWithMinimumPrice.billingCycleConfiguration - invoicingCycleConfiguration = tieredWithMinimumPrice.invoicingCycleConfiguration billableMetric = tieredWithMinimumPrice.billableMetric - fixedPriceQuantity = tieredWithMinimumPrice.fixedPriceQuantity - planPhaseOrder = tieredWithMinimumPrice.planPhaseOrder - currency = tieredWithMinimumPrice.currency + billingCycleConfiguration = tieredWithMinimumPrice.billingCycleConfiguration + cadence = tieredWithMinimumPrice.cadence conversionRate = tieredWithMinimumPrice.conversionRate - item = tieredWithMinimumPrice.item + createdAt = tieredWithMinimumPrice.createdAt creditAllocation = tieredWithMinimumPrice.creditAllocation + currency = tieredWithMinimumPrice.currency discount = tieredWithMinimumPrice.discount - minimum = tieredWithMinimumPrice.minimum - minimumAmount = tieredWithMinimumPrice.minimumAmount + externalPriceId = tieredWithMinimumPrice.externalPriceId + fixedPriceQuantity = tieredWithMinimumPrice.fixedPriceQuantity + invoicingCycleConfiguration = tieredWithMinimumPrice.invoicingCycleConfiguration + item = tieredWithMinimumPrice.item maximum = tieredWithMinimumPrice.maximum maximumAmount = tieredWithMinimumPrice.maximumAmount + metadata = tieredWithMinimumPrice.metadata + minimum = tieredWithMinimumPrice.minimum + minimumAmount = tieredWithMinimumPrice.minimumAmount + modelType = tieredWithMinimumPrice.modelType + name = tieredWithMinimumPrice.name + planPhaseOrder = tieredWithMinimumPrice.planPhaseOrder + priceType = tieredWithMinimumPrice.priceType tieredWithMinimumConfig = tieredWithMinimumPrice.tieredWithMinimumConfig additionalProperties = tieredWithMinimumPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -22152,30 +22144,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -22185,37 +22173,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -22227,16 +22219,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = tieredWithMinimumConfig(JsonField.of(tieredWithMinimumConfig)) @@ -22265,28 +22265,28 @@ private constructor( fun build(): TieredWithMinimumPrice = TieredWithMinimumPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, tieredWithMinimumConfig, additionalProperties.toImmutable(), ) @@ -22643,24 +22643,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22669,8 +22669,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -22684,21 +22684,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -22706,6 +22702,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -22730,8 +22730,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -22741,17 +22741,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -23044,19 +23044,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -23065,7 +23062,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -23075,6 +23072,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -23083,8 +23083,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -23098,26 +23098,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -23133,6 +23124,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -23157,8 +23157,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -23168,17 +23168,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -23268,19 +23268,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -23289,7 +23286,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -23299,6 +23296,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -23307,8 +23307,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -23322,26 +23322,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -23357,6 +23348,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -23381,8 +23381,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -23392,17 +23392,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -23599,87 +23599,87 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithMinimumPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && tieredWithMinimumConfig == other.tieredWithMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredWithMinimumConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredWithMinimumConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredWithMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredWithMinimumConfig=$tieredWithMinimumConfig, additionalProperties=$additionalProperties}" + "TieredWithMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredWithMinimumConfig=$tieredWithMinimumConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class TieredPackageWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("tiered_package_with_minimum_config") @ExcludeMissing private val tieredPackageWithMinimumConfig: JsonField = @@ -23688,126 +23688,126 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = - tieredPackageWithMinimumConfig.getRequired("tiered_package_with_minimum_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = + tieredPackageWithMinimumConfig.getRequired("tiered_package_with_minimum_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("tiered_package_with_minimum_config") @ExcludeMissing @@ -23821,28 +23821,28 @@ private constructor( fun validate(): TieredPackageWithMinimumPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() tieredPackageWithMinimumConfig().validate() validated = true } @@ -23857,30 +23857,30 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var tieredPackageWithMinimumConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -23888,72 +23888,64 @@ private constructor( @JvmSynthetic internal fun from(tieredPackageWithMinimumPrice: TieredPackageWithMinimumPrice) = apply { - metadata = tieredPackageWithMinimumPrice.metadata id = tieredPackageWithMinimumPrice.id - name = tieredPackageWithMinimumPrice.name - externalPriceId = tieredPackageWithMinimumPrice.externalPriceId - priceType = tieredPackageWithMinimumPrice.priceType - modelType = tieredPackageWithMinimumPrice.modelType - createdAt = tieredPackageWithMinimumPrice.createdAt - cadence = tieredPackageWithMinimumPrice.cadence + billableMetric = tieredPackageWithMinimumPrice.billableMetric billingCycleConfiguration = tieredPackageWithMinimumPrice.billingCycleConfiguration - invoicingCycleConfiguration = - tieredPackageWithMinimumPrice.invoicingCycleConfiguration - billableMetric = tieredPackageWithMinimumPrice.billableMetric - fixedPriceQuantity = tieredPackageWithMinimumPrice.fixedPriceQuantity - planPhaseOrder = tieredPackageWithMinimumPrice.planPhaseOrder - currency = tieredPackageWithMinimumPrice.currency + cadence = tieredPackageWithMinimumPrice.cadence conversionRate = tieredPackageWithMinimumPrice.conversionRate - item = tieredPackageWithMinimumPrice.item + createdAt = tieredPackageWithMinimumPrice.createdAt creditAllocation = tieredPackageWithMinimumPrice.creditAllocation + currency = tieredPackageWithMinimumPrice.currency discount = tieredPackageWithMinimumPrice.discount - minimum = tieredPackageWithMinimumPrice.minimum - minimumAmount = tieredPackageWithMinimumPrice.minimumAmount + externalPriceId = tieredPackageWithMinimumPrice.externalPriceId + fixedPriceQuantity = tieredPackageWithMinimumPrice.fixedPriceQuantity + invoicingCycleConfiguration = + tieredPackageWithMinimumPrice.invoicingCycleConfiguration + item = tieredPackageWithMinimumPrice.item maximum = tieredPackageWithMinimumPrice.maximum maximumAmount = tieredPackageWithMinimumPrice.maximumAmount + metadata = tieredPackageWithMinimumPrice.metadata + minimum = tieredPackageWithMinimumPrice.minimum + minimumAmount = tieredPackageWithMinimumPrice.minimumAmount + modelType = tieredPackageWithMinimumPrice.modelType + name = tieredPackageWithMinimumPrice.name + planPhaseOrder = tieredPackageWithMinimumPrice.planPhaseOrder + priceType = tieredPackageWithMinimumPrice.priceType tieredPackageWithMinimumConfig = tieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig additionalProperties = tieredPackageWithMinimumPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -23961,30 +23953,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -23994,37 +23982,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -24036,16 +24028,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun tieredPackageWithMinimumConfig( tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig ) = tieredPackageWithMinimumConfig(JsonField.of(tieredPackageWithMinimumConfig)) @@ -24075,28 +24075,28 @@ private constructor( fun build(): TieredPackageWithMinimumPrice = TieredPackageWithMinimumPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, tieredPackageWithMinimumConfig, additionalProperties.toImmutable(), ) @@ -24453,24 +24453,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -24479,8 +24479,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -24494,21 +24494,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -24516,6 +24512,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -24540,8 +24540,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -24551,17 +24551,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -24854,19 +24854,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -24875,7 +24872,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -24885,6 +24882,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -24893,8 +24893,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -24908,26 +24908,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -24943,6 +24934,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -24967,8 +24967,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -24978,17 +24978,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -25078,19 +25078,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -25099,7 +25096,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -25109,6 +25106,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -25117,8 +25117,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -25132,26 +25132,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -25167,6 +25158,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -25191,8 +25191,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -25202,17 +25202,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -25410,220 +25410,220 @@ private constructor( return true } - return /* spotless:off */ other is TieredPackageWithMinimumPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackageWithMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredPackageWithMinimumConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredPackageWithMinimumConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredPackageWithMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, additionalProperties=$additionalProperties}" + "TieredPackageWithMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class PackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), @JsonProperty("package_with_allocation_config") @ExcludeMissing private val packageWithAllocationConfig: 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun id(): String = id.getRequired("id") fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig.getRequired("package_with_allocation_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig.getRequired("package_with_allocation_config") - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun priceType(): PriceType = priceType.getRequired("price_type") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("package_with_allocation_config") @ExcludeMissing fun _packageWithAllocationConfig() = packageWithAllocationConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -25632,29 +25632,29 @@ private constructor( fun validate(): PackageWithAllocationPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() packageWithAllocationConfig().validate() + planPhaseOrder() + priceType() validated = true } } @@ -25668,99 +25668,91 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var packageWithAllocationConfig: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(packageWithAllocationPrice: PackageWithAllocationPrice) = apply { - metadata = packageWithAllocationPrice.metadata id = packageWithAllocationPrice.id - name = packageWithAllocationPrice.name - externalPriceId = packageWithAllocationPrice.externalPriceId - priceType = packageWithAllocationPrice.priceType - modelType = packageWithAllocationPrice.modelType - createdAt = packageWithAllocationPrice.createdAt - cadence = packageWithAllocationPrice.cadence - billingCycleConfiguration = packageWithAllocationPrice.billingCycleConfiguration - invoicingCycleConfiguration = packageWithAllocationPrice.invoicingCycleConfiguration billableMetric = packageWithAllocationPrice.billableMetric - fixedPriceQuantity = packageWithAllocationPrice.fixedPriceQuantity - planPhaseOrder = packageWithAllocationPrice.planPhaseOrder - currency = packageWithAllocationPrice.currency + billingCycleConfiguration = packageWithAllocationPrice.billingCycleConfiguration + cadence = packageWithAllocationPrice.cadence conversionRate = packageWithAllocationPrice.conversionRate - item = packageWithAllocationPrice.item + createdAt = packageWithAllocationPrice.createdAt creditAllocation = packageWithAllocationPrice.creditAllocation + currency = packageWithAllocationPrice.currency discount = packageWithAllocationPrice.discount - minimum = packageWithAllocationPrice.minimum - minimumAmount = packageWithAllocationPrice.minimumAmount + externalPriceId = packageWithAllocationPrice.externalPriceId + fixedPriceQuantity = packageWithAllocationPrice.fixedPriceQuantity + invoicingCycleConfiguration = packageWithAllocationPrice.invoicingCycleConfiguration + item = packageWithAllocationPrice.item maximum = packageWithAllocationPrice.maximum maximumAmount = packageWithAllocationPrice.maximumAmount + metadata = packageWithAllocationPrice.metadata + minimum = packageWithAllocationPrice.minimum + minimumAmount = packageWithAllocationPrice.minimumAmount + modelType = packageWithAllocationPrice.modelType + name = packageWithAllocationPrice.name packageWithAllocationConfig = packageWithAllocationPrice.packageWithAllocationConfig + planPhaseOrder = packageWithAllocationPrice.planPhaseOrder + priceType = packageWithAllocationPrice.priceType additionalProperties = packageWithAllocationPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -25768,30 +25760,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -25801,37 +25789,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -25843,15 +25835,13 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + fun name(name: JsonField) = apply { this.name = name } fun packageWithAllocationConfig( packageWithAllocationConfig: PackageWithAllocationConfig @@ -25861,6 +25851,16 @@ private constructor( packageWithAllocationConfig: JsonField ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -25882,29 +25882,29 @@ private constructor( fun build(): PackageWithAllocationPrice = PackageWithAllocationPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, packageWithAllocationConfig, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -26260,24 +26260,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26286,8 +26286,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -26301,21 +26301,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -26323,6 +26319,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -26347,8 +26347,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -26358,17 +26358,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -26661,19 +26661,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -26682,7 +26679,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -26692,6 +26689,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26700,8 +26700,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -26715,26 +26715,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -26750,6 +26741,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -26774,8 +26774,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -26785,17 +26785,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -26885,19 +26885,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -26906,7 +26903,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -26916,6 +26913,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26924,8 +26924,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -26939,26 +26939,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -26974,6 +26965,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -26998,8 +26998,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -27009,17 +27009,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -27217,87 +27217,87 @@ private constructor( return true } - return /* spotless:off */ other is PackageWithAllocationPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && packageWithAllocationConfig == other.packageWithAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackageWithAllocationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, packageWithAllocationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, packageWithAllocationConfig, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PackageWithAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, packageWithAllocationConfig=$packageWithAllocationConfig, additionalProperties=$additionalProperties}" + "PackageWithAllocationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class UnitWithPercentPrice @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("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") - @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), @JsonProperty("billable_metric") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), + private val cadence: JsonField = JsonMissing.of(), @JsonProperty("conversion_rate") @ExcludeMissing private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), @JsonProperty("credit_allocation") @ExcludeMissing private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonProperty("discount") @ExcludeMissing private val discount: JsonField = JsonMissing.of(), - @JsonProperty("minimum") + @JsonProperty("external_price_id") @ExcludeMissing - private val minimum: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), @JsonProperty("maximum") @ExcludeMissing private val maximum: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum") + @ExcludeMissing + private val minimum: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("unit_with_percent_config") @ExcludeMissing private val unitWithPercentConfig: JsonField = JsonMissing.of(), @@ -27305,126 +27305,126 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun unitWithPercentConfig(): UnitWithPercentConfig = - unitWithPercentConfig.getRequired("unit_with_percent_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun unitWithPercentConfig(): UnitWithPercentConfig = + unitWithPercentConfig.getRequired("unit_with_percent_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("unit_with_percent_config") @ExcludeMissing @@ -27438,28 +27438,28 @@ private constructor( fun validate(): UnitWithPercentPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() unitWithPercentConfig().validate() validated = true } @@ -27474,97 +27474,89 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var unitWithPercentConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(unitWithPercentPrice: UnitWithPercentPrice) = apply { - metadata = unitWithPercentPrice.metadata id = unitWithPercentPrice.id - name = unitWithPercentPrice.name - externalPriceId = unitWithPercentPrice.externalPriceId - priceType = unitWithPercentPrice.priceType - modelType = unitWithPercentPrice.modelType - createdAt = unitWithPercentPrice.createdAt - cadence = unitWithPercentPrice.cadence - billingCycleConfiguration = unitWithPercentPrice.billingCycleConfiguration - invoicingCycleConfiguration = unitWithPercentPrice.invoicingCycleConfiguration billableMetric = unitWithPercentPrice.billableMetric - fixedPriceQuantity = unitWithPercentPrice.fixedPriceQuantity - planPhaseOrder = unitWithPercentPrice.planPhaseOrder - currency = unitWithPercentPrice.currency + billingCycleConfiguration = unitWithPercentPrice.billingCycleConfiguration + cadence = unitWithPercentPrice.cadence conversionRate = unitWithPercentPrice.conversionRate - item = unitWithPercentPrice.item + createdAt = unitWithPercentPrice.createdAt creditAllocation = unitWithPercentPrice.creditAllocation + currency = unitWithPercentPrice.currency discount = unitWithPercentPrice.discount - minimum = unitWithPercentPrice.minimum - minimumAmount = unitWithPercentPrice.minimumAmount + externalPriceId = unitWithPercentPrice.externalPriceId + fixedPriceQuantity = unitWithPercentPrice.fixedPriceQuantity + invoicingCycleConfiguration = unitWithPercentPrice.invoicingCycleConfiguration + item = unitWithPercentPrice.item maximum = unitWithPercentPrice.maximum maximumAmount = unitWithPercentPrice.maximumAmount + metadata = unitWithPercentPrice.metadata + minimum = unitWithPercentPrice.minimum + minimumAmount = unitWithPercentPrice.minimumAmount + modelType = unitWithPercentPrice.modelType + name = unitWithPercentPrice.name + planPhaseOrder = unitWithPercentPrice.planPhaseOrder + priceType = unitWithPercentPrice.priceType unitWithPercentConfig = unitWithPercentPrice.unitWithPercentConfig additionalProperties = unitWithPercentPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -27572,30 +27564,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -27605,37 +27593,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -27647,16 +27639,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = unitWithPercentConfig(JsonField.of(unitWithPercentConfig)) @@ -27686,28 +27686,28 @@ private constructor( fun build(): UnitWithPercentPrice = UnitWithPercentPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, unitWithPercentConfig, additionalProperties.toImmutable(), ) @@ -28064,24 +28064,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -28090,8 +28090,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -28105,21 +28105,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -28127,6 +28123,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -28151,8 +28151,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -28162,17 +28162,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -28465,19 +28465,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -28486,7 +28483,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -28496,6 +28493,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -28504,8 +28504,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -28519,26 +28519,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -28554,6 +28545,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -28578,8 +28578,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -28589,17 +28589,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -28689,18 +28689,15 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") + ) { /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -28710,7 +28707,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -28720,6 +28717,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -28728,8 +28728,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -28743,26 +28743,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -28778,6 +28769,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -28802,8 +28802,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -28813,17 +28813,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -29019,219 +29019,219 @@ private constructor( return true } - return /* spotless:off */ other is UnitWithPercentPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && unitWithPercentConfig == other.unitWithPercentConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithPercentPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitWithPercentConfig == other.unitWithPercentConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitWithPercentConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitWithPercentConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UnitWithPercentPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitWithPercentConfig=$unitWithPercentConfig, additionalProperties=$additionalProperties}" + "UnitWithPercentPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitWithPercentConfig=$unitWithPercentConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class MatrixWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), + @JsonProperty("matrix_with_allocation_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val matrixWithAllocationConfig: JsonField = + JsonMissing.of(), + @JsonProperty("maximum") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("matrix_with_allocation_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val matrixWithAllocationConfig: JsonField = - JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") - - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = + matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = - matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") + @JsonProperty("matrix_with_allocation_config") @ExcludeMissing - fun _creditAllocation() = creditAllocation + fun _matrixWithAllocationConfig() = matrixWithAllocationConfig - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("matrix_with_allocation_config") - @ExcludeMissing - fun _matrixWithAllocationConfig() = matrixWithAllocationConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -29241,29 +29241,29 @@ private constructor( fun validate(): MatrixWithAllocationPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() + matrixWithAllocationConfig().validate() maximum().map { it.validate() } maximumAmount() - matrixWithAllocationConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -29277,98 +29277,90 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var maximum: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var matrixWithAllocationConfig: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixWithAllocationPrice: MatrixWithAllocationPrice) = apply { - metadata = matrixWithAllocationPrice.metadata id = matrixWithAllocationPrice.id - name = matrixWithAllocationPrice.name - externalPriceId = matrixWithAllocationPrice.externalPriceId - priceType = matrixWithAllocationPrice.priceType - modelType = matrixWithAllocationPrice.modelType - createdAt = matrixWithAllocationPrice.createdAt - cadence = matrixWithAllocationPrice.cadence - billingCycleConfiguration = matrixWithAllocationPrice.billingCycleConfiguration - invoicingCycleConfiguration = matrixWithAllocationPrice.invoicingCycleConfiguration billableMetric = matrixWithAllocationPrice.billableMetric - fixedPriceQuantity = matrixWithAllocationPrice.fixedPriceQuantity - planPhaseOrder = matrixWithAllocationPrice.planPhaseOrder - currency = matrixWithAllocationPrice.currency + billingCycleConfiguration = matrixWithAllocationPrice.billingCycleConfiguration + cadence = matrixWithAllocationPrice.cadence conversionRate = matrixWithAllocationPrice.conversionRate - item = matrixWithAllocationPrice.item + createdAt = matrixWithAllocationPrice.createdAt creditAllocation = matrixWithAllocationPrice.creditAllocation + currency = matrixWithAllocationPrice.currency discount = matrixWithAllocationPrice.discount - minimum = matrixWithAllocationPrice.minimum - minimumAmount = matrixWithAllocationPrice.minimumAmount + externalPriceId = matrixWithAllocationPrice.externalPriceId + fixedPriceQuantity = matrixWithAllocationPrice.fixedPriceQuantity + invoicingCycleConfiguration = matrixWithAllocationPrice.invoicingCycleConfiguration + item = matrixWithAllocationPrice.item + matrixWithAllocationConfig = matrixWithAllocationPrice.matrixWithAllocationConfig maximum = matrixWithAllocationPrice.maximum maximumAmount = matrixWithAllocationPrice.maximumAmount - matrixWithAllocationConfig = matrixWithAllocationPrice.matrixWithAllocationConfig + metadata = matrixWithAllocationPrice.metadata + minimum = matrixWithAllocationPrice.minimum + minimumAmount = matrixWithAllocationPrice.minimumAmount + modelType = matrixWithAllocationPrice.modelType + name = matrixWithAllocationPrice.name + planPhaseOrder = matrixWithAllocationPrice.planPhaseOrder + priceType = matrixWithAllocationPrice.priceType additionalProperties = matrixWithAllocationPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -29376,30 +29368,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -29409,37 +29397,48 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun item(item: Item) = item(JsonField.of(item)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun item(item: JsonField) = apply { this.item = item } - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun matrixWithAllocationConfig(matrixWithAllocationConfig: MatrixWithAllocationConfig) = + matrixWithAllocationConfig(JsonField.of(matrixWithAllocationConfig)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun matrixWithAllocationConfig( + matrixWithAllocationConfig: JsonField + ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } - fun item(item: Item) = item(JsonField.of(item)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun item(item: JsonField) = apply { this.item = item } + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -29451,22 +29450,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun matrixWithAllocationConfig(matrixWithAllocationConfig: MatrixWithAllocationConfig) = - matrixWithAllocationConfig(JsonField.of(matrixWithAllocationConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun matrixWithAllocationConfig( - matrixWithAllocationConfig: JsonField - ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -29489,29 +29489,29 @@ private constructor( fun build(): MatrixWithAllocationPrice = MatrixWithAllocationPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, + matrixWithAllocationConfig, maximum, maximumAmount, - matrixWithAllocationConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -29867,24 +29867,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -29893,8 +29893,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -29908,21 +29908,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -29930,6 +29926,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -29954,8 +29954,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -29965,17 +29965,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -30268,48 +30268,48 @@ private constructor( class MatrixWithAllocationConfig @JsonCreator private constructor( - @JsonProperty("dimensions") + @JsonProperty("allocation") @ExcludeMissing - private val dimensions: JsonField> = JsonMissing.of(), + private val allocation: JsonField = JsonMissing.of(), @JsonProperty("default_unit_amount") @ExcludeMissing private val defaultUnitAmount: JsonField = JsonMissing.of(), + @JsonProperty("dimensions") + @ExcludeMissing + private val dimensions: JsonField> = JsonMissing.of(), @JsonProperty("matrix_values") @ExcludeMissing private val matrixValues: JsonField> = JsonMissing.of(), - @JsonProperty("allocation") - @ExcludeMissing - private val allocation: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(): List = dimensions.getRequired("dimensions") + /** Allocation to be used to calculate the price */ + fun allocation(): Double = allocation.getRequired("allocation") /** Default per unit rate for any usage not bucketed into a specified matrix_value */ fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(): List = dimensions.getRequired("dimensions") + /** Matrix values for specified matrix grouping keys */ fun matrixValues(): List = matrixValues.getRequired("matrix_values") /** Allocation to be used to calculate the price */ - fun allocation(): Double = allocation.getRequired("allocation") - - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions + @JsonProperty("allocation") @ExcludeMissing fun _allocation() = allocation /** Default per unit rate for any usage not bucketed into a specified matrix_value */ @JsonProperty("default_unit_amount") @ExcludeMissing fun _defaultUnitAmount() = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") @ExcludeMissing fun _matrixValues() = matrixValues - /** Allocation to be used to calculate the price */ - @JsonProperty("allocation") @ExcludeMissing fun _allocation() = allocation - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -30318,10 +30318,10 @@ private constructor( fun validate(): MatrixWithAllocationConfig = apply { if (!validated) { - dimensions() + allocation() defaultUnitAmount() + dimensions() matrixValues().forEach { it.validate() } - allocation() validated = true } } @@ -30335,28 +30335,28 @@ private constructor( class Builder { - private var dimensions: JsonField> = JsonMissing.of() + private var allocation: JsonField = JsonMissing.of() private var defaultUnitAmount: JsonField = JsonMissing.of() + private var dimensions: JsonField> = JsonMissing.of() private var matrixValues: JsonField> = JsonMissing.of() - private var allocation: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixWithAllocationConfig: MatrixWithAllocationConfig) = apply { - dimensions = matrixWithAllocationConfig.dimensions + allocation = matrixWithAllocationConfig.allocation defaultUnitAmount = matrixWithAllocationConfig.defaultUnitAmount + dimensions = matrixWithAllocationConfig.dimensions matrixValues = matrixWithAllocationConfig.matrixValues - allocation = matrixWithAllocationConfig.allocation additionalProperties = matrixWithAllocationConfig.additionalProperties.toMutableMap() } - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) + /** Allocation to be used to calculate the price */ + fun allocation(allocation: Double) = allocation(JsonField.of(allocation)) - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: JsonField>) = apply { - this.dimensions = dimensions + /** Allocation to be used to calculate the price */ + fun allocation(allocation: JsonField) = apply { + this.allocation = allocation } /** @@ -30372,6 +30372,14 @@ private constructor( this.defaultUnitAmount = defaultUnitAmount } + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) + + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: JsonField>) = apply { + this.dimensions = dimensions + } + /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = matrixValues(JsonField.of(matrixValues)) @@ -30381,14 +30389,6 @@ private constructor( this.matrixValues = matrixValues } - /** Allocation to be used to calculate the price */ - fun allocation(allocation: Double) = allocation(JsonField.of(allocation)) - - /** Allocation to be used to calculate the price */ - fun allocation(allocation: JsonField) = apply { - this.allocation = allocation - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -30413,10 +30413,10 @@ private constructor( fun build(): MatrixWithAllocationConfig = MatrixWithAllocationConfig( - dimensions.map { it.toImmutable() }, + allocation, defaultUnitAmount, + dimensions.map { it.toImmutable() }, matrixValues.map { it.toImmutable() }, - allocation, additionalProperties.toImmutable(), ) } @@ -30425,19 +30425,16 @@ private constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") - @ExcludeMissing - private val unitAmount: JsonField = JsonMissing.of(), @JsonProperty("dimension_values") @ExcludeMissing private val dimensionValues: JsonField> = JsonMissing.of(), + @JsonProperty("unit_amount") + @ExcludeMissing + private val unitAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and an @@ -30447,7 +30444,7 @@ private constructor( dimensionValues.getRequired("dimension_values") /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + fun unitAmount(): String = unitAmount.getRequired("unit_amount") /** * One or two matrix keys to filter usage to this Matrix value by. For example, @@ -30458,6 +30455,9 @@ private constructor( @ExcludeMissing fun _dimensionValues() = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -30466,8 +30466,8 @@ private constructor( fun validate(): MatrixValue = apply { if (!validated) { - unitAmount() dimensionValues() + unitAmount() validated = true } } @@ -30481,25 +30481,17 @@ private constructor( class Builder { - private var unitAmount: JsonField = JsonMissing.of() private var dimensionValues: JsonField> = JsonMissing.of() + private var unitAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and @@ -30517,6 +30509,14 @@ private constructor( this.dimensionValues = dimensionValues } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -30541,8 +30541,8 @@ private constructor( fun build(): MatrixValue = MatrixValue( - unitAmount, dimensionValues.map { it.toImmutable() }, + unitAmount, additionalProperties.toImmutable(), ) } @@ -30552,17 +30552,17 @@ private constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -30570,36 +30570,33 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithAllocationConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && allocation == other.allocation && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithAllocationConfig && allocation == other.allocation && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, allocation, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allocation, defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithAllocationConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, allocation=$allocation, additionalProperties=$additionalProperties}" + "MatrixWithAllocationConfig{allocation=$allocation, defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } @NoAutoDetect class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -30608,7 +30605,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -30618,6 +30615,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -30626,8 +30626,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -30641,26 +30641,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -30676,6 +30667,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -30700,8 +30700,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -30711,17 +30711,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -30811,19 +30811,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -30832,7 +30829,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -30842,6 +30839,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -30850,8 +30850,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -30865,26 +30865,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -30900,6 +30891,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -30924,8 +30924,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -30935,17 +30935,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -31061,87 +31061,87 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithAllocationPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && matrixWithAllocationConfig == other.matrixWithAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithAllocationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithAllocationConfig == other.matrixWithAllocationConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixWithAllocationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithAllocationConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixWithAllocationConfig=$matrixWithAllocationConfig, additionalProperties=$additionalProperties}" + "MatrixWithAllocationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithAllocationConfig=$matrixWithAllocationConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class TieredWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") + @ExcludeMissing + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_proration_config") @ExcludeMissing private val tieredWithProrationConfig: JsonField = @@ -31150,126 +31150,126 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig.getRequired("tiered_with_proration_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig.getRequired("tiered_with_proration_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("tiered_with_proration_config") @ExcludeMissing @@ -31283,28 +31283,28 @@ private constructor( fun validate(): TieredWithProrationPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() tieredWithProrationConfig().validate() validated = true } @@ -31319,98 +31319,90 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var tieredWithProrationConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tieredWithProrationPrice: TieredWithProrationPrice) = apply { - metadata = tieredWithProrationPrice.metadata id = tieredWithProrationPrice.id - name = tieredWithProrationPrice.name - externalPriceId = tieredWithProrationPrice.externalPriceId - priceType = tieredWithProrationPrice.priceType - modelType = tieredWithProrationPrice.modelType - createdAt = tieredWithProrationPrice.createdAt - cadence = tieredWithProrationPrice.cadence - billingCycleConfiguration = tieredWithProrationPrice.billingCycleConfiguration - invoicingCycleConfiguration = tieredWithProrationPrice.invoicingCycleConfiguration billableMetric = tieredWithProrationPrice.billableMetric - fixedPriceQuantity = tieredWithProrationPrice.fixedPriceQuantity - planPhaseOrder = tieredWithProrationPrice.planPhaseOrder - currency = tieredWithProrationPrice.currency + billingCycleConfiguration = tieredWithProrationPrice.billingCycleConfiguration + cadence = tieredWithProrationPrice.cadence conversionRate = tieredWithProrationPrice.conversionRate - item = tieredWithProrationPrice.item + createdAt = tieredWithProrationPrice.createdAt creditAllocation = tieredWithProrationPrice.creditAllocation + currency = tieredWithProrationPrice.currency discount = tieredWithProrationPrice.discount - minimum = tieredWithProrationPrice.minimum - minimumAmount = tieredWithProrationPrice.minimumAmount + externalPriceId = tieredWithProrationPrice.externalPriceId + fixedPriceQuantity = tieredWithProrationPrice.fixedPriceQuantity + invoicingCycleConfiguration = tieredWithProrationPrice.invoicingCycleConfiguration + item = tieredWithProrationPrice.item maximum = tieredWithProrationPrice.maximum maximumAmount = tieredWithProrationPrice.maximumAmount + metadata = tieredWithProrationPrice.metadata + minimum = tieredWithProrationPrice.minimum + minimumAmount = tieredWithProrationPrice.minimumAmount + modelType = tieredWithProrationPrice.modelType + name = tieredWithProrationPrice.name + planPhaseOrder = tieredWithProrationPrice.planPhaseOrder + priceType = tieredWithProrationPrice.priceType tieredWithProrationConfig = tieredWithProrationPrice.tieredWithProrationConfig additionalProperties = tieredWithProrationPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -31418,30 +31410,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -31451,37 +31439,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -31493,16 +31485,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) @@ -31531,28 +31531,28 @@ private constructor( fun build(): TieredWithProrationPrice = TieredWithProrationPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, tieredWithProrationConfig, additionalProperties.toImmutable(), ) @@ -31909,24 +31909,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -31935,8 +31935,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -31950,21 +31950,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -31972,6 +31968,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -31996,8 +31996,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -32007,17 +32007,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -32310,19 +32310,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -32331,7 +32328,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -32341,6 +32338,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -32349,8 +32349,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -32364,26 +32364,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -32399,6 +32390,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -32423,8 +32423,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -32434,17 +32434,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -32534,19 +32534,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -32555,7 +32552,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -32565,6 +32562,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -32573,8 +32573,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -32588,26 +32588,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -32623,6 +32614,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -32647,8 +32647,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -32658,17 +32658,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -32865,87 +32865,87 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithProrationPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && tieredWithProrationConfig == other.tieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredWithProrationConfig == other.tieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredWithProrationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredWithProrationConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredWithProrationConfig=$tieredWithProrationConfig, additionalProperties=$additionalProperties}" + "TieredWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredWithProrationConfig=$tieredWithProrationConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class UnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: JsonField = JsonMissing.of(), @JsonProperty("unit_with_proration_config") @ExcludeMissing private val unitWithProrationConfig: JsonField = JsonMissing.of(), @@ -32953,126 +32953,126 @@ private constructor( 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun unitWithProrationConfig(): UnitWithProrationConfig = - unitWithProrationConfig.getRequired("unit_with_proration_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + fun unitWithProrationConfig(): UnitWithProrationConfig = + unitWithProrationConfig.getRequired("unit_with_proration_config") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonProperty("unit_with_proration_config") @ExcludeMissing @@ -33086,28 +33086,28 @@ private constructor( fun validate(): UnitWithProrationPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() unitWithProrationConfig().validate() validated = true } @@ -33122,98 +33122,90 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var unitWithProrationConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(unitWithProrationPrice: UnitWithProrationPrice) = apply { - metadata = unitWithProrationPrice.metadata id = unitWithProrationPrice.id - name = unitWithProrationPrice.name - externalPriceId = unitWithProrationPrice.externalPriceId - priceType = unitWithProrationPrice.priceType - modelType = unitWithProrationPrice.modelType - createdAt = unitWithProrationPrice.createdAt - cadence = unitWithProrationPrice.cadence - billingCycleConfiguration = unitWithProrationPrice.billingCycleConfiguration - invoicingCycleConfiguration = unitWithProrationPrice.invoicingCycleConfiguration billableMetric = unitWithProrationPrice.billableMetric - fixedPriceQuantity = unitWithProrationPrice.fixedPriceQuantity - planPhaseOrder = unitWithProrationPrice.planPhaseOrder - currency = unitWithProrationPrice.currency + billingCycleConfiguration = unitWithProrationPrice.billingCycleConfiguration + cadence = unitWithProrationPrice.cadence conversionRate = unitWithProrationPrice.conversionRate - item = unitWithProrationPrice.item + createdAt = unitWithProrationPrice.createdAt creditAllocation = unitWithProrationPrice.creditAllocation + currency = unitWithProrationPrice.currency discount = unitWithProrationPrice.discount - minimum = unitWithProrationPrice.minimum - minimumAmount = unitWithProrationPrice.minimumAmount + externalPriceId = unitWithProrationPrice.externalPriceId + fixedPriceQuantity = unitWithProrationPrice.fixedPriceQuantity + invoicingCycleConfiguration = unitWithProrationPrice.invoicingCycleConfiguration + item = unitWithProrationPrice.item maximum = unitWithProrationPrice.maximum maximumAmount = unitWithProrationPrice.maximumAmount + metadata = unitWithProrationPrice.metadata + minimum = unitWithProrationPrice.minimum + minimumAmount = unitWithProrationPrice.minimumAmount + modelType = unitWithProrationPrice.modelType + name = unitWithProrationPrice.name + planPhaseOrder = unitWithProrationPrice.planPhaseOrder + priceType = unitWithProrationPrice.priceType unitWithProrationConfig = unitWithProrationPrice.unitWithProrationConfig additionalProperties = unitWithProrationPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -33221,30 +33213,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -33254,37 +33242,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -33296,16 +33288,24 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) @@ -33334,28 +33334,28 @@ private constructor( fun build(): UnitWithProrationPrice = UnitWithProrationPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, unitWithProrationConfig, additionalProperties.toImmutable(), ) @@ -33712,24 +33712,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -33738,8 +33738,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -33753,21 +33753,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -33775,6 +33771,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -33799,8 +33799,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -33810,17 +33810,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -34113,19 +34113,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -34134,7 +34131,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -34144,6 +34141,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -34152,8 +34152,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -34167,26 +34167,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -34202,6 +34193,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -34226,8 +34226,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -34237,17 +34237,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -34337,19 +34337,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -34358,7 +34355,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -34368,6 +34365,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -34376,8 +34376,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -34391,26 +34391,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -34426,6 +34417,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -34450,8 +34450,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -34461,17 +34461,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -34668,218 +34668,218 @@ private constructor( return true } - return /* spotless:off */ other is UnitWithProrationPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && unitWithProrationConfig == other.unitWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitWithProrationConfig == other.unitWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitWithProrationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitWithProrationConfig, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UnitWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitWithProrationConfig=$unitWithProrationConfig, additionalProperties=$additionalProperties}" + "UnitWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitWithProrationConfig=$unitWithProrationConfig, additionalProperties=$additionalProperties}" } @NoAutoDetect class GroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + @JsonProperty("grouped_allocation_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val groupedAllocationConfig: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("grouped_allocation_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val groupedAllocationConfig: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") + fun groupedAllocationConfig(): GroupedAllocationConfig = + groupedAllocationConfig.getRequired("grouped_allocation_config") - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedAllocationConfig(): GroupedAllocationConfig = - groupedAllocationConfig.getRequired("grouped_allocation_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("grouped_allocation_config") + @ExcludeMissing + fun _groupedAllocationConfig() = groupedAllocationConfig - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("grouped_allocation_config") - @ExcludeMissing - fun _groupedAllocationConfig() = groupedAllocationConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -34889,29 +34889,29 @@ private constructor( fun validate(): GroupedAllocationPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + groupedAllocationConfig().validate() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - groupedAllocationConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -34925,98 +34925,90 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var maximum: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() private var groupedAllocationConfig: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(groupedAllocationPrice: GroupedAllocationPrice) = apply { - metadata = groupedAllocationPrice.metadata id = groupedAllocationPrice.id - name = groupedAllocationPrice.name - externalPriceId = groupedAllocationPrice.externalPriceId - priceType = groupedAllocationPrice.priceType - modelType = groupedAllocationPrice.modelType - createdAt = groupedAllocationPrice.createdAt - cadence = groupedAllocationPrice.cadence - billingCycleConfiguration = groupedAllocationPrice.billingCycleConfiguration - invoicingCycleConfiguration = groupedAllocationPrice.invoicingCycleConfiguration billableMetric = groupedAllocationPrice.billableMetric - fixedPriceQuantity = groupedAllocationPrice.fixedPriceQuantity - planPhaseOrder = groupedAllocationPrice.planPhaseOrder - currency = groupedAllocationPrice.currency + billingCycleConfiguration = groupedAllocationPrice.billingCycleConfiguration + cadence = groupedAllocationPrice.cadence conversionRate = groupedAllocationPrice.conversionRate - item = groupedAllocationPrice.item + createdAt = groupedAllocationPrice.createdAt creditAllocation = groupedAllocationPrice.creditAllocation + currency = groupedAllocationPrice.currency discount = groupedAllocationPrice.discount - minimum = groupedAllocationPrice.minimum - minimumAmount = groupedAllocationPrice.minimumAmount + externalPriceId = groupedAllocationPrice.externalPriceId + fixedPriceQuantity = groupedAllocationPrice.fixedPriceQuantity + groupedAllocationConfig = groupedAllocationPrice.groupedAllocationConfig + invoicingCycleConfiguration = groupedAllocationPrice.invoicingCycleConfiguration + item = groupedAllocationPrice.item maximum = groupedAllocationPrice.maximum maximumAmount = groupedAllocationPrice.maximumAmount - groupedAllocationConfig = groupedAllocationPrice.groupedAllocationConfig + metadata = groupedAllocationPrice.metadata + minimum = groupedAllocationPrice.minimum + minimumAmount = groupedAllocationPrice.minimumAmount + modelType = groupedAllocationPrice.modelType + name = groupedAllocationPrice.name + planPhaseOrder = groupedAllocationPrice.planPhaseOrder + priceType = groupedAllocationPrice.priceType additionalProperties = groupedAllocationPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -35024,30 +35016,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -35057,37 +35045,48 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun groupedAllocationConfig( + groupedAllocationConfig: JsonField + ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -35099,22 +35098,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun groupedAllocationConfig( - groupedAllocationConfig: JsonField - ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -35137,29 +35137,29 @@ private constructor( fun build(): GroupedAllocationPrice = GroupedAllocationPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + groupedAllocationConfig, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - groupedAllocationConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -35515,24 +35515,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -35541,8 +35541,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -35556,21 +35556,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -35578,6 +35574,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -35602,8 +35602,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -35613,17 +35613,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -35997,19 +35997,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -36018,7 +36015,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -36028,6 +36025,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -36036,8 +36036,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -36051,26 +36051,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -36086,6 +36077,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -36110,8 +36110,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -36121,17 +36121,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -36221,19 +36221,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -36242,7 +36239,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -36252,6 +36249,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -36260,8 +36260,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -36275,26 +36275,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -36310,6 +36301,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -36334,8 +36334,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -36345,17 +36345,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -36471,219 +36471,219 @@ private constructor( return true } - return /* spotless:off */ other is GroupedAllocationPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && groupedAllocationConfig == other.groupedAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedAllocationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedAllocationConfig == other.groupedAllocationConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedAllocationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedAllocationConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedAllocationConfig=$groupedAllocationConfig, additionalProperties=$additionalProperties}" + "GroupedAllocationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedAllocationConfig=$groupedAllocationConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class GroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + @JsonProperty("grouped_with_prorated_minimum_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val groupedWithProratedMinimumConfig: JsonField = + JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("grouped_with_prorated_minimum_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val groupedWithProratedMinimumConfig: JsonField = - JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("grouped_with_prorated_minimum_config") + @ExcludeMissing + fun _groupedWithProratedMinimumConfig() = groupedWithProratedMinimumConfig - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("grouped_with_prorated_minimum_config") - @ExcludeMissing - fun _groupedWithProratedMinimumConfig() = groupedWithProratedMinimumConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -36693,29 +36693,29 @@ private constructor( fun validate(): GroupedWithProratedMinimumPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + groupedWithProratedMinimumConfig().validate() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - groupedWithProratedMinimumConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -36729,104 +36729,96 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var maximum: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() private var groupedWithProratedMinimumConfig: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(groupedWithProratedMinimumPrice: GroupedWithProratedMinimumPrice) = apply { - metadata = groupedWithProratedMinimumPrice.metadata id = groupedWithProratedMinimumPrice.id - name = groupedWithProratedMinimumPrice.name - externalPriceId = groupedWithProratedMinimumPrice.externalPriceId - priceType = groupedWithProratedMinimumPrice.priceType - modelType = groupedWithProratedMinimumPrice.modelType - createdAt = groupedWithProratedMinimumPrice.createdAt - cadence = groupedWithProratedMinimumPrice.cadence + billableMetric = groupedWithProratedMinimumPrice.billableMetric billingCycleConfiguration = groupedWithProratedMinimumPrice.billingCycleConfiguration - invoicingCycleConfiguration = - groupedWithProratedMinimumPrice.invoicingCycleConfiguration - billableMetric = groupedWithProratedMinimumPrice.billableMetric - fixedPriceQuantity = groupedWithProratedMinimumPrice.fixedPriceQuantity - planPhaseOrder = groupedWithProratedMinimumPrice.planPhaseOrder - currency = groupedWithProratedMinimumPrice.currency + cadence = groupedWithProratedMinimumPrice.cadence conversionRate = groupedWithProratedMinimumPrice.conversionRate - item = groupedWithProratedMinimumPrice.item + createdAt = groupedWithProratedMinimumPrice.createdAt creditAllocation = groupedWithProratedMinimumPrice.creditAllocation + currency = groupedWithProratedMinimumPrice.currency discount = groupedWithProratedMinimumPrice.discount - minimum = groupedWithProratedMinimumPrice.minimum - minimumAmount = groupedWithProratedMinimumPrice.minimumAmount - maximum = groupedWithProratedMinimumPrice.maximum - maximumAmount = groupedWithProratedMinimumPrice.maximumAmount + externalPriceId = groupedWithProratedMinimumPrice.externalPriceId + fixedPriceQuantity = groupedWithProratedMinimumPrice.fixedPriceQuantity groupedWithProratedMinimumConfig = groupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig + invoicingCycleConfiguration = + groupedWithProratedMinimumPrice.invoicingCycleConfiguration + item = groupedWithProratedMinimumPrice.item + maximum = groupedWithProratedMinimumPrice.maximum + maximumAmount = groupedWithProratedMinimumPrice.maximumAmount + metadata = groupedWithProratedMinimumPrice.metadata + minimum = groupedWithProratedMinimumPrice.minimum + minimumAmount = groupedWithProratedMinimumPrice.minimumAmount + modelType = groupedWithProratedMinimumPrice.modelType + name = groupedWithProratedMinimumPrice.name + planPhaseOrder = groupedWithProratedMinimumPrice.planPhaseOrder + priceType = groupedWithProratedMinimumPrice.priceType additionalProperties = groupedWithProratedMinimumPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -36834,30 +36826,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -36867,37 +36855,49 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: JsonField + ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -36909,23 +36909,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: JsonField - ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -36948,29 +36948,29 @@ private constructor( fun build(): GroupedWithProratedMinimumPrice = GroupedWithProratedMinimumPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + groupedWithProratedMinimumConfig, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - groupedWithProratedMinimumConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -37326,24 +37326,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -37352,8 +37352,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -37367,21 +37367,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -37389,6 +37385,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -37413,8 +37413,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -37424,17 +37424,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -37810,19 +37810,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -37831,7 +37828,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -37841,6 +37838,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -37849,8 +37849,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -37864,26 +37864,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -37899,6 +37890,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -37923,8 +37923,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -37934,17 +37934,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -38034,19 +38034,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -38055,7 +38052,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -38065,6 +38062,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -38073,8 +38073,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -38088,26 +38088,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -38123,6 +38114,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -38147,8 +38147,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -38158,17 +38158,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -38284,219 +38284,219 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithProratedMinimumPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithProratedMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedWithProratedMinimumConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithProratedMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithProratedMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, additionalProperties=$additionalProperties}" + "GroupedWithProratedMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class GroupedWithMeteredMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + @JsonProperty("grouped_with_metered_minimum_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val groupedWithMeteredMinimumConfig: JsonField = + JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("grouped_with_metered_minimum_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val groupedWithMeteredMinimumConfig: JsonField = - JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") + fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("grouped_with_metered_minimum_config") + @ExcludeMissing + fun _groupedWithMeteredMinimumConfig() = groupedWithMeteredMinimumConfig - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("grouped_with_metered_minimum_config") - @ExcludeMissing - fun _groupedWithMeteredMinimumConfig() = groupedWithMeteredMinimumConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -38506,29 +38506,29 @@ private constructor( fun validate(): GroupedWithMeteredMinimumPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + groupedWithMeteredMinimumConfig().validate() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - groupedWithMeteredMinimumConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -38542,104 +38542,96 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var maximum: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() private var groupedWithMeteredMinimumConfig: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(groupedWithMeteredMinimumPrice: GroupedWithMeteredMinimumPrice) = apply { - metadata = groupedWithMeteredMinimumPrice.metadata id = groupedWithMeteredMinimumPrice.id - name = groupedWithMeteredMinimumPrice.name - externalPriceId = groupedWithMeteredMinimumPrice.externalPriceId - priceType = groupedWithMeteredMinimumPrice.priceType - modelType = groupedWithMeteredMinimumPrice.modelType - createdAt = groupedWithMeteredMinimumPrice.createdAt - cadence = groupedWithMeteredMinimumPrice.cadence + billableMetric = groupedWithMeteredMinimumPrice.billableMetric billingCycleConfiguration = groupedWithMeteredMinimumPrice.billingCycleConfiguration - invoicingCycleConfiguration = - groupedWithMeteredMinimumPrice.invoicingCycleConfiguration - billableMetric = groupedWithMeteredMinimumPrice.billableMetric - fixedPriceQuantity = groupedWithMeteredMinimumPrice.fixedPriceQuantity - planPhaseOrder = groupedWithMeteredMinimumPrice.planPhaseOrder - currency = groupedWithMeteredMinimumPrice.currency + cadence = groupedWithMeteredMinimumPrice.cadence conversionRate = groupedWithMeteredMinimumPrice.conversionRate - item = groupedWithMeteredMinimumPrice.item + createdAt = groupedWithMeteredMinimumPrice.createdAt creditAllocation = groupedWithMeteredMinimumPrice.creditAllocation + currency = groupedWithMeteredMinimumPrice.currency discount = groupedWithMeteredMinimumPrice.discount - minimum = groupedWithMeteredMinimumPrice.minimum - minimumAmount = groupedWithMeteredMinimumPrice.minimumAmount - maximum = groupedWithMeteredMinimumPrice.maximum - maximumAmount = groupedWithMeteredMinimumPrice.maximumAmount + externalPriceId = groupedWithMeteredMinimumPrice.externalPriceId + fixedPriceQuantity = groupedWithMeteredMinimumPrice.fixedPriceQuantity groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig + invoicingCycleConfiguration = + groupedWithMeteredMinimumPrice.invoicingCycleConfiguration + item = groupedWithMeteredMinimumPrice.item + maximum = groupedWithMeteredMinimumPrice.maximum + maximumAmount = groupedWithMeteredMinimumPrice.maximumAmount + metadata = groupedWithMeteredMinimumPrice.metadata + minimum = groupedWithMeteredMinimumPrice.minimum + minimumAmount = groupedWithMeteredMinimumPrice.minimumAmount + modelType = groupedWithMeteredMinimumPrice.modelType + name = groupedWithMeteredMinimumPrice.name + planPhaseOrder = groupedWithMeteredMinimumPrice.planPhaseOrder + priceType = groupedWithMeteredMinimumPrice.priceType additionalProperties = groupedWithMeteredMinimumPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -38647,30 +38639,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -38680,37 +38668,49 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: JsonField + ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -38722,23 +38722,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: JsonField - ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -38761,29 +38761,29 @@ private constructor( fun build(): GroupedWithMeteredMinimumPrice = GroupedWithMeteredMinimumPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + groupedWithMeteredMinimumConfig, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - groupedWithMeteredMinimumConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -39139,24 +39139,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -39165,8 +39165,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -39180,21 +39180,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -39202,6 +39198,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -39226,8 +39226,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -39237,17 +39237,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -39623,19 +39623,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -39644,7 +39641,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -39654,6 +39651,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -39662,8 +39662,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -39677,26 +39677,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -39712,6 +39703,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -39736,8 +39736,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -39747,17 +39747,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -39847,19 +39847,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -39868,7 +39865,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -39878,6 +39875,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -39886,8 +39886,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -39901,26 +39901,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -39936,6 +39927,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -39960,8 +39960,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -39971,17 +39971,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -40097,219 +40097,219 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithMeteredMinimumPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimumPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedWithMeteredMinimumConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithMeteredMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithMeteredMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimumPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class MatrixWithDisplayNamePrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), + @JsonProperty("matrix_with_display_name_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val matrixWithDisplayNameConfig: JsonField = + JsonMissing.of(), + @JsonProperty("maximum") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("matrix_with_display_name_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val matrixWithDisplayNameConfig: JsonField = - JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") - - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = + matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = - matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") + @JsonProperty("matrix_with_display_name_config") @ExcludeMissing - fun _creditAllocation() = creditAllocation + fun _matrixWithDisplayNameConfig() = matrixWithDisplayNameConfig - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("matrix_with_display_name_config") - @ExcludeMissing - fun _matrixWithDisplayNameConfig() = matrixWithDisplayNameConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -40319,29 +40319,29 @@ private constructor( fun validate(): MatrixWithDisplayNamePrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() + matrixWithDisplayNameConfig().validate() maximum().map { it.validate() } maximumAmount() - matrixWithDisplayNameConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -40355,99 +40355,91 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var maximum: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var matrixWithDisplayNameConfig: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice) = apply { - metadata = matrixWithDisplayNamePrice.metadata id = matrixWithDisplayNamePrice.id - name = matrixWithDisplayNamePrice.name - externalPriceId = matrixWithDisplayNamePrice.externalPriceId - priceType = matrixWithDisplayNamePrice.priceType - modelType = matrixWithDisplayNamePrice.modelType - createdAt = matrixWithDisplayNamePrice.createdAt - cadence = matrixWithDisplayNamePrice.cadence - billingCycleConfiguration = matrixWithDisplayNamePrice.billingCycleConfiguration - invoicingCycleConfiguration = matrixWithDisplayNamePrice.invoicingCycleConfiguration billableMetric = matrixWithDisplayNamePrice.billableMetric - fixedPriceQuantity = matrixWithDisplayNamePrice.fixedPriceQuantity - planPhaseOrder = matrixWithDisplayNamePrice.planPhaseOrder - currency = matrixWithDisplayNamePrice.currency + billingCycleConfiguration = matrixWithDisplayNamePrice.billingCycleConfiguration + cadence = matrixWithDisplayNamePrice.cadence conversionRate = matrixWithDisplayNamePrice.conversionRate - item = matrixWithDisplayNamePrice.item + createdAt = matrixWithDisplayNamePrice.createdAt creditAllocation = matrixWithDisplayNamePrice.creditAllocation + currency = matrixWithDisplayNamePrice.currency discount = matrixWithDisplayNamePrice.discount - minimum = matrixWithDisplayNamePrice.minimum - minimumAmount = matrixWithDisplayNamePrice.minimumAmount + externalPriceId = matrixWithDisplayNamePrice.externalPriceId + fixedPriceQuantity = matrixWithDisplayNamePrice.fixedPriceQuantity + invoicingCycleConfiguration = matrixWithDisplayNamePrice.invoicingCycleConfiguration + item = matrixWithDisplayNamePrice.item + matrixWithDisplayNameConfig = matrixWithDisplayNamePrice.matrixWithDisplayNameConfig maximum = matrixWithDisplayNamePrice.maximum maximumAmount = matrixWithDisplayNamePrice.maximumAmount - matrixWithDisplayNameConfig = matrixWithDisplayNamePrice.matrixWithDisplayNameConfig + metadata = matrixWithDisplayNamePrice.metadata + minimum = matrixWithDisplayNamePrice.minimum + minimumAmount = matrixWithDisplayNamePrice.minimumAmount + modelType = matrixWithDisplayNamePrice.modelType + name = matrixWithDisplayNamePrice.name + planPhaseOrder = matrixWithDisplayNamePrice.planPhaseOrder + priceType = matrixWithDisplayNamePrice.priceType additionalProperties = matrixWithDisplayNamePrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -40455,30 +40447,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -40488,37 +40476,49 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - fun currency(currency: String) = currency(JsonField.of(currency)) + fun item(item: Item) = item(JsonField.of(item)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun item(item: JsonField) = apply { this.item = item } - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig + ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: JsonField + ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - fun item(item: Item) = item(JsonField.of(item)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun item(item: JsonField) = apply { this.item = item } + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -40530,23 +40530,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig - ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: JsonField - ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -40569,29 +40569,29 @@ private constructor( fun build(): MatrixWithDisplayNamePrice = MatrixWithDisplayNamePrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, + matrixWithDisplayNameConfig, maximum, maximumAmount, - matrixWithDisplayNameConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -40947,24 +40947,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -40973,8 +40973,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -40988,21 +40988,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -41010,6 +41006,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -41034,8 +41034,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -41045,17 +41045,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -41430,19 +41430,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -41451,7 +41448,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -41461,6 +41458,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -41469,8 +41469,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -41484,26 +41484,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -41519,6 +41510,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -41543,8 +41543,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -41554,17 +41554,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -41654,19 +41654,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -41675,7 +41672,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -41685,6 +41682,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -41693,8 +41693,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -41708,26 +41708,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -41743,6 +41734,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -41767,8 +41767,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -41778,17 +41778,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -41904,218 +41904,218 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithDisplayNamePrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayNamePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixWithDisplayNameConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithDisplayNameConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithDisplayNamePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, additionalProperties=$additionalProperties}" + "MatrixWithDisplayNamePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class BulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("bulk_with_proration_config") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val bulkWithProrationConfig: JsonField = JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("bulk_with_proration_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val bulkWithProrationConfig: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - fun priceType(): PriceType = priceType.getRequired("price_type") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - fun cadence(): Cadence = cadence.getRequired("cadence") - - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") - - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - fun billableMetric(): Optional = Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun bulkWithProrationConfig(): BulkWithProrationConfig = + bulkWithProrationConfig.getRequired("bulk_with_proration_config") - fun currency(): String = currency.getRequired("currency") + fun cadence(): Cadence = cadence.getRequired("cadence") fun conversionRate(): Optional = Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun item(): Item = item.getRequired("item") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun creditAllocation(): Optional = Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + fun currency(): String = currency.getRequired("currency") + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun item(): Item = item.getRequired("item") fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bulkWithProrationConfig(): BulkWithProrationConfig = - bulkWithProrationConfig.getRequired("bulk_with_proration_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + fun modelType(): ModelType = modelType.getRequired("model_type") + + fun name(): String = name.getRequired("name") + + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + + fun priceType(): PriceType = priceType.getRequired("price_type") @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration() = billingCycleConfiguration + + @JsonProperty("bulk_with_proration_config") + @ExcludeMissing + fun _bulkWithProrationConfig() = bulkWithProrationConfig - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence - - @JsonProperty("billing_cycle_configuration") + @JsonProperty("credit_allocation") @ExcludeMissing - fun _billingCycleConfiguration() = billingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency - - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("bulk_with_proration_config") - @ExcludeMissing - fun _bulkWithProrationConfig() = bulkWithProrationConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -42125,29 +42125,29 @@ private constructor( fun validate(): BulkWithProrationPrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + bulkWithProrationConfig().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - bulkWithProrationConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -42161,98 +42161,97 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = + private var bulkWithProrationConfig: JsonField = JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bulkWithProrationConfig: JsonField = - JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(bulkWithProrationPrice: BulkWithProrationPrice) = apply { - metadata = bulkWithProrationPrice.metadata id = bulkWithProrationPrice.id - name = bulkWithProrationPrice.name - externalPriceId = bulkWithProrationPrice.externalPriceId - priceType = bulkWithProrationPrice.priceType - modelType = bulkWithProrationPrice.modelType - createdAt = bulkWithProrationPrice.createdAt - cadence = bulkWithProrationPrice.cadence - billingCycleConfiguration = bulkWithProrationPrice.billingCycleConfiguration - invoicingCycleConfiguration = bulkWithProrationPrice.invoicingCycleConfiguration billableMetric = bulkWithProrationPrice.billableMetric - fixedPriceQuantity = bulkWithProrationPrice.fixedPriceQuantity - planPhaseOrder = bulkWithProrationPrice.planPhaseOrder - currency = bulkWithProrationPrice.currency + billingCycleConfiguration = bulkWithProrationPrice.billingCycleConfiguration + bulkWithProrationConfig = bulkWithProrationPrice.bulkWithProrationConfig + cadence = bulkWithProrationPrice.cadence conversionRate = bulkWithProrationPrice.conversionRate - item = bulkWithProrationPrice.item + createdAt = bulkWithProrationPrice.createdAt creditAllocation = bulkWithProrationPrice.creditAllocation + currency = bulkWithProrationPrice.currency discount = bulkWithProrationPrice.discount - minimum = bulkWithProrationPrice.minimum - minimumAmount = bulkWithProrationPrice.minimumAmount + externalPriceId = bulkWithProrationPrice.externalPriceId + fixedPriceQuantity = bulkWithProrationPrice.fixedPriceQuantity + invoicingCycleConfiguration = bulkWithProrationPrice.invoicingCycleConfiguration + item = bulkWithProrationPrice.item maximum = bulkWithProrationPrice.maximum maximumAmount = bulkWithProrationPrice.maximumAmount - bulkWithProrationConfig = bulkWithProrationPrice.bulkWithProrationConfig + metadata = bulkWithProrationPrice.metadata + minimum = bulkWithProrationPrice.minimum + minimumAmount = bulkWithProrationPrice.minimumAmount + modelType = bulkWithProrationPrice.modelType + name = bulkWithProrationPrice.name + planPhaseOrder = bulkWithProrationPrice.planPhaseOrder + priceType = bulkWithProrationPrice.priceType additionalProperties = bulkWithProrationPrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun bulkWithProrationConfig( + bulkWithProrationConfig: JsonField + ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) + + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -42260,30 +42259,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -42293,37 +42288,41 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -42335,22 +42334,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun bulkWithProrationConfig( - bulkWithProrationConfig: JsonField - ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -42373,29 +42373,29 @@ private constructor( fun build(): BulkWithProrationPrice = BulkWithProrationPrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + bulkWithProrationConfig, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - bulkWithProrationConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -42832,24 +42832,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -42858,8 +42858,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -42873,21 +42873,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -42895,6 +42891,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -42919,8 +42919,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -42930,17 +42930,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -43233,19 +43233,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -43254,7 +43251,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -43264,6 +43261,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -43272,8 +43272,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -43287,26 +43287,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -43322,6 +43313,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -43346,8 +43346,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -43357,17 +43357,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -43457,19 +43457,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -43478,7 +43475,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -43488,6 +43485,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -43496,8 +43496,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -43511,26 +43511,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -43546,6 +43537,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -43570,8 +43570,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -43581,17 +43581,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -43707,219 +43707,219 @@ private constructor( return true } - return /* spotless:off */ other is BulkWithProrationPrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && bulkWithProrationConfig == other.bulkWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkWithProrationPrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkWithProrationConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkWithProrationConfig, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BulkWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkWithProrationConfig=$bulkWithProrationConfig, additionalProperties=$additionalProperties}" + "BulkWithProrationPrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } @NoAutoDetect class GroupedTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("name") + @JsonProperty("billable_metric") @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") + private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("price_type") + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") @ExcludeMissing - private val priceType: JsonField = JsonMissing.of(), - @JsonProperty("model_type") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("conversion_rate") @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), + private val conversionRate: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), - @JsonProperty("cadence") + @JsonProperty("credit_allocation") @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") + private val creditAllocation: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("discount") @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric") + private val discount: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") @ExcludeMissing - private val billableMetric: JsonField = JsonMissing.of(), + private val externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("fixed_price_quantity") @ExcludeMissing private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") - @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("currency") + @JsonProperty("grouped_tiered_package_config") @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("conversion_rate") + private val groupedTieredPackageConfig: JsonField = + JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), @JsonProperty("item") @ExcludeMissing private val item: JsonField = JsonMissing.of(), - @JsonProperty("credit_allocation") + @JsonProperty("maximum") @ExcludeMissing - private val creditAllocation: JsonField = JsonMissing.of(), - @JsonProperty("discount") + private val maximum: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") @ExcludeMissing - private val discount: JsonField = JsonMissing.of(), + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonProperty("minimum") @ExcludeMissing private val minimum: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum") + @JsonProperty("model_type") @ExcludeMissing - private val maximum: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("grouped_tiered_package_config") + private val name: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") @ExcludeMissing - private val groupedTieredPackageConfig: JsonField = - JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price_type") + @ExcludeMissing + private val priceType: 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 billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") - fun priceType(): PriceType = priceType.getRequired("price_type") + fun cadence(): Cadence = cadence.getRequired("cadence") - fun modelType(): ModelType = modelType.getRequired("model_type") + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun cadence(): Cadence = cadence.getRequired("cadence") + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - fun billingCycleConfiguration(): BillingCycleConfiguration = - billingCycleConfiguration.getRequired("billing_cycle_configuration") + fun currency(): String = currency.getRequired("currency") - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - fun billableMetric(): Optional = - Optional.ofNullable(billableMetric.getNullable("billable_metric")) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - - fun currency(): String = currency.getRequired("currency") + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) fun item(): Item = item.getRequired("item") - fun creditAllocation(): Optional = - Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) - - fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) - - fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - - fun minimumAmount(): Optional = - Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = - groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") - /** * 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 + fun metadata(): Metadata = metadata.getRequired("metadata") - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) - @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + fun modelType(): ModelType = modelType.getRequired("model_type") - @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + fun name(): String = name.getRequired("name") - @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + fun priceType(): PriceType = priceType.getRequired("price_type") - @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("billing_cycle_configuration") @ExcludeMissing fun _billingCycleConfiguration() = billingCycleConfiguration - @JsonProperty("invoicing_cycle_configuration") + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("credit_allocation") @ExcludeMissing - fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + fun _creditAllocation() = creditAllocation - @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId @JsonProperty("fixed_price_quantity") @ExcludeMissing fun _fixedPriceQuantity() = fixedPriceQuantity - @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + fun _groupedTieredPackageConfig() = groupedTieredPackageConfig - @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration @JsonProperty("item") @ExcludeMissing fun _item() = item - @JsonProperty("credit_allocation") - @ExcludeMissing - fun _creditAllocation() = creditAllocation + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum - @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * 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("minimum") @ExcludeMissing fun _minimum() = minimum @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("grouped_tiered_package_config") - @ExcludeMissing - fun _groupedTieredPackageConfig() = groupedTieredPackageConfig + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType @JsonAnyGetter @ExcludeMissing @@ -43929,29 +43929,29 @@ private constructor( fun validate(): GroupedTieredPackagePrice = apply { if (!validated) { - metadata().validate() id() - name() - externalPriceId() - priceType() - modelType() - createdAt() - cadence() - billingCycleConfiguration().validate() - invoicingCycleConfiguration().map { it.validate() } billableMetric().map { it.validate() } - fixedPriceQuantity() - planPhaseOrder() - currency() + billingCycleConfiguration().validate() + cadence() conversionRate() - item().validate() + createdAt() creditAllocation().map { it.validate() } + currency() discount() - minimum().map { it.validate() } - minimumAmount() + externalPriceId() + fixedPriceQuantity() + groupedTieredPackageConfig().validate() + invoicingCycleConfiguration().map { it.validate() } + item().validate() maximum().map { it.validate() } maximumAmount() - groupedTieredPackageConfig().validate() + metadata().validate() + minimum().map { it.validate() } + minimumAmount() + modelType() + name() + planPhaseOrder() + priceType() validated = true } } @@ -43965,98 +43965,90 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var priceType: JsonField = JsonMissing.of() - private var modelType: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var cadence: JsonField = JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() private var billingCycleConfiguration: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var billableMetric: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var planPhaseOrder: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() private var conversionRate: JsonField = JsonMissing.of() - private var item: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var creditAllocation: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var discount: JsonField = JsonMissing.of() - private var minimum: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var maximum: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() private var groupedTieredPackageConfig: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var item: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(groupedTieredPackagePrice: GroupedTieredPackagePrice) = apply { - metadata = groupedTieredPackagePrice.metadata id = groupedTieredPackagePrice.id - name = groupedTieredPackagePrice.name - externalPriceId = groupedTieredPackagePrice.externalPriceId - priceType = groupedTieredPackagePrice.priceType - modelType = groupedTieredPackagePrice.modelType - createdAt = groupedTieredPackagePrice.createdAt - cadence = groupedTieredPackagePrice.cadence - billingCycleConfiguration = groupedTieredPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = groupedTieredPackagePrice.invoicingCycleConfiguration billableMetric = groupedTieredPackagePrice.billableMetric - fixedPriceQuantity = groupedTieredPackagePrice.fixedPriceQuantity - planPhaseOrder = groupedTieredPackagePrice.planPhaseOrder - currency = groupedTieredPackagePrice.currency + billingCycleConfiguration = groupedTieredPackagePrice.billingCycleConfiguration + cadence = groupedTieredPackagePrice.cadence conversionRate = groupedTieredPackagePrice.conversionRate - item = groupedTieredPackagePrice.item + createdAt = groupedTieredPackagePrice.createdAt creditAllocation = groupedTieredPackagePrice.creditAllocation + currency = groupedTieredPackagePrice.currency discount = groupedTieredPackagePrice.discount - minimum = groupedTieredPackagePrice.minimum - minimumAmount = groupedTieredPackagePrice.minimumAmount + externalPriceId = groupedTieredPackagePrice.externalPriceId + fixedPriceQuantity = groupedTieredPackagePrice.fixedPriceQuantity + groupedTieredPackageConfig = groupedTieredPackagePrice.groupedTieredPackageConfig + invoicingCycleConfiguration = groupedTieredPackagePrice.invoicingCycleConfiguration + item = groupedTieredPackagePrice.item maximum = groupedTieredPackagePrice.maximum maximumAmount = groupedTieredPackagePrice.maximumAmount - groupedTieredPackageConfig = groupedTieredPackagePrice.groupedTieredPackageConfig + metadata = groupedTieredPackagePrice.metadata + minimum = groupedTieredPackagePrice.minimum + minimumAmount = groupedTieredPackagePrice.minimumAmount + modelType = groupedTieredPackagePrice.modelType + name = groupedTieredPackagePrice.name + planPhaseOrder = groupedTieredPackagePrice.planPhaseOrder + priceType = groupedTieredPackagePrice.priceType additionalProperties = groupedTieredPackagePrice.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 billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) - fun name(name: JsonField) = apply { this.name = name } + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } - fun externalPriceId(externalPriceId: String) = - externalPriceId(JsonField.of(externalPriceId)) + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) @@ -44064,30 +44056,26 @@ private constructor( this.createdAt = createdAt } - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + fun currency(currency: String) = currency(JsonField.of(currency)) - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun currency(currency: JsonField) = apply { this.currency = currency } - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + fun discount(discount: Discount) = discount(JsonField.of(discount)) - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun discount(discount: JsonField) = apply { this.discount = discount } - fun billableMetric(billableMetric: BillableMetric) = - billableMetric(JsonField.of(billableMetric)) + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) - fun billableMetric(billableMetric: JsonField) = apply { - this.billableMetric = billableMetric + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } fun fixedPriceQuantity(fixedPriceQuantity: Double) = @@ -44097,37 +44085,48 @@ private constructor( this.fixedPriceQuantity = fixedPriceQuantity } - fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) - - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - fun currency(currency: String) = currency(JsonField.of(currency)) + fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) - fun currency(currency: JsonField) = apply { this.currency = currency } + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: JsonField + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } - fun conversionRate(conversionRate: Double) = - conversionRate(JsonField.of(conversionRate)) + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } fun item(item: Item) = item(JsonField.of(item)) fun item(item: JsonField) = apply { this.item = item } - fun creditAllocation(creditAllocation: CreditAllocation) = - creditAllocation(JsonField.of(creditAllocation)) + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) - fun creditAllocation(creditAllocation: JsonField) = apply { - this.creditAllocation = creditAllocation + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } - fun discount(discount: Discount) = discount(JsonField.of(discount)) + /** + * 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)) - fun discount(discount: JsonField) = apply { this.discount = discount } + /** + * 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 minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) @@ -44139,22 +44138,23 @@ private constructor( this.minimumAmount = minimumAmount } - fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + fun name(name: String) = name(JsonField.of(name)) - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun name(name: JsonField) = apply { this.name = name } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder } - fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = - groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) - fun groupedTieredPackageConfig( - groupedTieredPackageConfig: JsonField - ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -44177,29 +44177,29 @@ private constructor( fun build(): GroupedTieredPackagePrice = GroupedTieredPackagePrice( - metadata, id, - name, - externalPriceId, - priceType, - modelType, - createdAt, - cadence, - billingCycleConfiguration, - invoicingCycleConfiguration, billableMetric, - fixedPriceQuantity, - planPhaseOrder, - currency, + billingCycleConfiguration, + cadence, conversionRate, - item, + createdAt, creditAllocation, + currency, discount, - minimum, - minimumAmount, + externalPriceId, + fixedPriceQuantity, + groupedTieredPackageConfig, + invoicingCycleConfiguration, + item, maximum, maximumAmount, - groupedTieredPackageConfig, + metadata, + minimum, + minimumAmount, + modelType, + name, + planPhaseOrder, + priceType, additionalProperties.toImmutable(), ) } @@ -44555,24 +44555,24 @@ private constructor( class CreditAllocation @JsonCreator private constructor( - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), @JsonProperty("allows_rollover") @ExcludeMissing private val allowsRollover: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun currency(): String = currency.getRequired("currency") - fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + fun currency(): String = currency.getRequired("currency") @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -44581,8 +44581,8 @@ private constructor( fun validate(): CreditAllocation = apply { if (!validated) { - currency() allowsRollover() + currency() validated = true } } @@ -44596,21 +44596,17 @@ private constructor( class Builder { - private var currency: JsonField = JsonMissing.of() private var allowsRollover: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditAllocation: CreditAllocation) = apply { - currency = creditAllocation.currency allowsRollover = creditAllocation.allowsRollover + currency = creditAllocation.currency additionalProperties = creditAllocation.additionalProperties.toMutableMap() } - fun currency(currency: String) = currency(JsonField.of(currency)) - - fun currency(currency: JsonField) = apply { this.currency = currency } - fun allowsRollover(allowsRollover: Boolean) = allowsRollover(JsonField.of(allowsRollover)) @@ -44618,6 +44614,10 @@ private constructor( this.allowsRollover = allowsRollover } + fun currency(currency: String) = currency(JsonField.of(currency)) + + fun currency(currency: JsonField) = apply { this.currency = currency } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -44642,8 +44642,8 @@ private constructor( fun build(): CreditAllocation = CreditAllocation( - currency, allowsRollover, + currency, additionalProperties.toImmutable(), ) } @@ -44653,17 +44653,17 @@ private constructor( return true } - return /* spotless:off */ other is CreditAllocation && currency == other.currency && allowsRollover == other.allowsRollover && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreditAllocation && allowsRollover == other.allowsRollover && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, allowsRollover, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowsRollover, currency, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + "CreditAllocation{allowsRollover=$allowsRollover, currency=$currency, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -45037,19 +45037,16 @@ private constructor( class Maximum @JsonCreator private constructor( - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") - /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. @@ -45058,7 +45055,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, @@ -45068,6 +45065,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -45076,8 +45076,8 @@ private constructor( fun validate(): Maximum = apply { if (!validated) { - maximumAmount() appliesToPriceIds() + maximumAmount() validated = true } } @@ -45091,26 +45091,17 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximum: Maximum) = apply { - maximumAmount = maximum.maximumAmount appliesToPriceIds = maximum.appliesToPriceIds + maximumAmount = maximum.maximumAmount additionalProperties = maximum.additionalProperties.toMutableMap() } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - /** * List of price_ids that this maximum amount applies to. For plan/plan phase * maximums, this can be a subset of prices. @@ -45126,6 +45117,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -45150,8 +45150,8 @@ private constructor( fun build(): Maximum = Maximum( - maximumAmount, appliesToPriceIds.map { it.toImmutable() }, + maximumAmount, additionalProperties.toImmutable(), ) } @@ -45161,17 +45161,17 @@ private constructor( return true } - return /* spotless:off */ other is Maximum && maximumAmount == other.maximumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, maximumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" } /** @@ -45261,19 +45261,16 @@ private constructor( class Minimum @JsonCreator private constructor( - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, * this can be a subset of prices. @@ -45282,7 +45279,7 @@ private constructor( appliesToPriceIds.getRequired("applies_to_price_ids") /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, @@ -45292,6 +45289,9 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -45300,8 +45300,8 @@ private constructor( fun validate(): Minimum = apply { if (!validated) { - minimumAmount() appliesToPriceIds() + minimumAmount() validated = true } } @@ -45315,26 +45315,17 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimum: Minimum) = apply { - minimumAmount = minimum.minimumAmount appliesToPriceIds = minimum.appliesToPriceIds + minimumAmount = minimum.minimumAmount additionalProperties = minimum.additionalProperties.toMutableMap() } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - /** * List of price_ids that this minimum amount applies to. For plan/plan phase * minimums, this can be a subset of prices. @@ -45350,6 +45341,15 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -45374,8 +45374,8 @@ private constructor( fun build(): Minimum = Minimum( - minimumAmount, appliesToPriceIds.map { it.toImmutable() }, + minimumAmount, additionalProperties.toImmutable(), ) } @@ -45385,17 +45385,17 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && minimumAmount == other.minimumAmount && appliesToPriceIds == other.appliesToPriceIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && appliesToPriceIds == other.appliesToPriceIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, minimumAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } class ModelType @@ -45511,16 +45511,16 @@ private constructor( return true } - return /* spotless:off */ other is GroupedTieredPackagePrice && metadata == other.metadata && id == other.id && name == other.name && externalPriceId == other.externalPriceId && priceType == other.priceType && modelType == other.modelType && createdAt == other.createdAt && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && billableMetric == other.billableMetric && fixedPriceQuantity == other.fixedPriceQuantity && planPhaseOrder == other.planPhaseOrder && currency == other.currency && conversionRate == other.conversionRate && item == other.item && creditAllocation == other.creditAllocation && discount == other.discount && minimum == other.minimum && minimumAmount == other.minimumAmount && maximum == other.maximum && maximumAmount == other.maximumAmount && groupedTieredPackageConfig == other.groupedTieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackagePrice && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredPackageConfig == other.groupedTieredPackageConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedTieredPackageConfig, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredPackageConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedTieredPackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedTieredPackageConfig=$groupedTieredPackageConfig, additionalProperties=$additionalProperties}" + "GroupedTieredPackagePrice{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredPackageConfig=$groupedTieredPackageConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt index ef3ca41e..12087044 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt @@ -1343,48 +1343,47 @@ constructor( class NewFloatingUnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_config") private val unitConfig: UnitConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -1392,6 +1391,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -1400,14 +1412,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -1416,16 +1420,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -1440,118 +1440,190 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitConfig: UnitConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitConfig: UnitConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingUnitPrice: NewFloatingUnitPrice) = apply { - metadata = newFloatingUnitPrice.metadata - externalPriceId = newFloatingUnitPrice.externalPriceId + cadence = newFloatingUnitPrice.cadence + currency = newFloatingUnitPrice.currency + itemId = newFloatingUnitPrice.itemId + modelType = newFloatingUnitPrice.modelType name = newFloatingUnitPrice.name + unitConfig = newFloatingUnitPrice.unitConfig billableMetricId = newFloatingUnitPrice.billableMetricId - itemId = newFloatingUnitPrice.itemId billedInAdvance = newFloatingUnitPrice.billedInAdvance + billingCycleConfiguration = newFloatingUnitPrice.billingCycleConfiguration + conversionRate = newFloatingUnitPrice.conversionRate + externalPriceId = newFloatingUnitPrice.externalPriceId fixedPriceQuantity = newFloatingUnitPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingUnitPrice.invoiceGroupingKey - cadence = newFloatingUnitPrice.cadence - billingCycleConfiguration = newFloatingUnitPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingUnitPrice.invoicingCycleConfiguration - conversionRate = newFloatingUnitPrice.conversionRate - modelType = newFloatingUnitPrice.modelType - unitConfig = newFloatingUnitPrice.unitConfig - currency = newFloatingUnitPrice.currency + metadata = newFloatingUnitPrice.metadata additionalProperties = newFloatingUnitPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1574,21 +1646,21 @@ constructor( fun build(): NewFloatingUnitPrice = NewFloatingUnitPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -2203,65 +2275,64 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingUnitPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitConfig == other.unitConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingUnitPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingUnitPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitConfig=$unitConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingUnitPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_config") private val packageConfig: PackageConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -2269,6 +2340,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -2277,14 +2361,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -2293,16 +2369,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -2317,120 +2389,192 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageConfig: PackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageConfig: PackageConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingPackagePrice: NewFloatingPackagePrice) = apply { - metadata = newFloatingPackagePrice.metadata - externalPriceId = newFloatingPackagePrice.externalPriceId + cadence = newFloatingPackagePrice.cadence + currency = newFloatingPackagePrice.currency + itemId = newFloatingPackagePrice.itemId + modelType = newFloatingPackagePrice.modelType name = newFloatingPackagePrice.name + packageConfig = newFloatingPackagePrice.packageConfig billableMetricId = newFloatingPackagePrice.billableMetricId - itemId = newFloatingPackagePrice.itemId billedInAdvance = newFloatingPackagePrice.billedInAdvance + billingCycleConfiguration = newFloatingPackagePrice.billingCycleConfiguration + conversionRate = newFloatingPackagePrice.conversionRate + externalPriceId = newFloatingPackagePrice.externalPriceId fixedPriceQuantity = newFloatingPackagePrice.fixedPriceQuantity invoiceGroupingKey = newFloatingPackagePrice.invoiceGroupingKey - cadence = newFloatingPackagePrice.cadence - billingCycleConfiguration = newFloatingPackagePrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingPackagePrice.invoicingCycleConfiguration - conversionRate = newFloatingPackagePrice.conversionRate - modelType = newFloatingPackagePrice.modelType - packageConfig = newFloatingPackagePrice.packageConfig - currency = newFloatingPackagePrice.currency + metadata = newFloatingPackagePrice.metadata additionalProperties = newFloatingPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageConfig(packageConfig: PackageConfig) = apply { + this.packageConfig = packageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - fun packageConfig(packageConfig: PackageConfig) = apply { - this.packageConfig = packageConfig + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2453,21 +2597,21 @@ constructor( fun build(): NewFloatingPackagePrice = NewFloatingPackagePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(packageConfig) { "`packageConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(packageConfig) { "`packageConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -3102,54 +3246,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageConfig == other.packageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingPackagePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageConfig=$packageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingPackagePrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingMatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -3158,9 +3304,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -3168,7 +3311,20 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -3176,14 +3332,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -3192,16 +3340,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -3216,120 +3360,192 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var matrixConfig: MatrixConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixConfig: MatrixConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingMatrixPrice: NewFloatingMatrixPrice) = apply { - metadata = newFloatingMatrixPrice.metadata - externalPriceId = newFloatingMatrixPrice.externalPriceId + cadence = newFloatingMatrixPrice.cadence + currency = newFloatingMatrixPrice.currency + itemId = newFloatingMatrixPrice.itemId + matrixConfig = newFloatingMatrixPrice.matrixConfig + modelType = newFloatingMatrixPrice.modelType name = newFloatingMatrixPrice.name billableMetricId = newFloatingMatrixPrice.billableMetricId - itemId = newFloatingMatrixPrice.itemId billedInAdvance = newFloatingMatrixPrice.billedInAdvance + billingCycleConfiguration = newFloatingMatrixPrice.billingCycleConfiguration + conversionRate = newFloatingMatrixPrice.conversionRate + externalPriceId = newFloatingMatrixPrice.externalPriceId fixedPriceQuantity = newFloatingMatrixPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingMatrixPrice.invoiceGroupingKey - cadence = newFloatingMatrixPrice.cadence - billingCycleConfiguration = newFloatingMatrixPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingMatrixPrice.invoicingCycleConfiguration - conversionRate = newFloatingMatrixPrice.conversionRate - modelType = newFloatingMatrixPrice.modelType - matrixConfig = newFloatingMatrixPrice.matrixConfig - currency = newFloatingMatrixPrice.currency + metadata = newFloatingMatrixPrice.metadata additionalProperties = newFloatingMatrixPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = apply { + this.matrixConfig = matrixConfig } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - fun matrixConfig(matrixConfig: MatrixConfig) = apply { - this.matrixConfig = matrixConfig + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3352,21 +3568,21 @@ constructor( fun build(): NewFloatingMatrixPrice = NewFloatingMatrixPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixConfig) { "`matrixConfig` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixConfig) { "`matrixConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -3456,19 +3672,19 @@ constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues @@ -3485,19 +3701,26 @@ constructor( class Builder { - private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions.toMutableList() defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.toMutableList() matrixValues = matrixConfig.matrixValues.toMutableList() additionalProperties = matrixConfig.additionalProperties.toMutableMap() } + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -3508,13 +3731,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -3549,11 +3765,11 @@ constructor( fun build(): MatrixConfig = MatrixConfig( - checkNotNull(dimensions) { "`dimensions` is required but was not set" } - .toImmutable(), checkNotNull(defaultUnitAmount) { "`defaultUnitAmount` is required but was not set" }, + checkNotNull(dimensions) { "`dimensions` is required but was not set" } + .toImmutable(), checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } .toImmutable(), additionalProperties.toImmutable(), @@ -3564,15 +3780,12 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and an @@ -3581,6 +3794,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3594,20 +3810,17 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and @@ -3627,6 +3840,9 @@ constructor( (dimensionValues ?: mutableListOf()).apply { add(dimensionValue) } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3651,11 +3867,11 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -3665,17 +3881,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3683,17 +3899,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -4141,55 +4357,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingMatrixPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixConfig == other.matrixConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingMatrixPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMatrixPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixConfig=$matrixConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingMatrixPrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingMatrixWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_with_allocation_config") + private val matrixWithAllocationConfig: MatrixWithAllocationConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_with_allocation_config") - private val matrixWithAllocationConfig: MatrixWithAllocationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_with_allocation_config") + fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = matrixWithAllocationConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -4198,9 +4417,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -4208,6 +4424,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -4216,14 +4445,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -4232,17 +4453,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_with_allocation_config") - fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = matrixWithAllocationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -4257,60 +4473,64 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var matrixWithAllocationConfig: MatrixWithAllocationConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixWithAllocationConfig: MatrixWithAllocationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice ) = apply { - metadata = newFloatingMatrixWithAllocationPrice.metadata - externalPriceId = newFloatingMatrixWithAllocationPrice.externalPriceId + cadence = newFloatingMatrixWithAllocationPrice.cadence + currency = newFloatingMatrixWithAllocationPrice.currency + itemId = newFloatingMatrixWithAllocationPrice.itemId + matrixWithAllocationConfig = + newFloatingMatrixWithAllocationPrice.matrixWithAllocationConfig + modelType = newFloatingMatrixWithAllocationPrice.modelType name = newFloatingMatrixWithAllocationPrice.name billableMetricId = newFloatingMatrixWithAllocationPrice.billableMetricId - itemId = newFloatingMatrixWithAllocationPrice.itemId billedInAdvance = newFloatingMatrixWithAllocationPrice.billedInAdvance - fixedPriceQuantity = newFloatingMatrixWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixWithAllocationPrice.invoiceGroupingKey - cadence = newFloatingMatrixWithAllocationPrice.cadence billingCycleConfiguration = newFloatingMatrixWithAllocationPrice.billingCycleConfiguration + conversionRate = newFloatingMatrixWithAllocationPrice.conversionRate + externalPriceId = newFloatingMatrixWithAllocationPrice.externalPriceId + fixedPriceQuantity = newFloatingMatrixWithAllocationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingMatrixWithAllocationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingMatrixWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newFloatingMatrixWithAllocationPrice.conversionRate - modelType = newFloatingMatrixWithAllocationPrice.modelType - matrixWithAllocationConfig = - newFloatingMatrixWithAllocationPrice.matrixWithAllocationConfig - currency = newFloatingMatrixWithAllocationPrice.currency + metadata = newFloatingMatrixWithAllocationPrice.metadata additionalProperties = newFloatingMatrixWithAllocationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixWithAllocationConfig(matrixWithAllocationConfig: MatrixWithAllocationConfig) = + apply { + this.matrixWithAllocationConfig = matrixWithAllocationConfig + } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -4318,66 +4538,134 @@ constructor( /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun matrixWithAllocationConfig(matrixWithAllocationConfig: MatrixWithAllocationConfig) = - apply { - this.matrixWithAllocationConfig = matrixWithAllocationConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4400,23 +4688,23 @@ constructor( fun build(): NewFloatingMatrixWithAllocationPrice = NewFloatingMatrixWithAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixWithAllocationConfig) { + "`matrixWithAllocationConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixWithAllocationConfig) { - "`matrixWithAllocationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -4506,26 +4794,26 @@ constructor( class MatrixWithAllocationConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, + @JsonProperty("allocation") private val allocation: Double, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, - @JsonProperty("allocation") private val allocation: Double, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Allocation to be used to calculate the price */ + @JsonProperty("allocation") fun allocation(): Double = allocation /** Default per unit rate for any usage not bucketed into a specified matrix_value */ @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues - /** Allocation to be used to calculate the price */ - @JsonProperty("allocation") fun allocation(): Double = allocation - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4539,22 +4827,32 @@ constructor( class Builder { - private var dimensions: MutableList? = null + private var allocation: Double? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null - private var allocation: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixWithAllocationConfig: MatrixWithAllocationConfig) = apply { - dimensions = matrixWithAllocationConfig.dimensions.toMutableList() + allocation = matrixWithAllocationConfig.allocation defaultUnitAmount = matrixWithAllocationConfig.defaultUnitAmount + dimensions = matrixWithAllocationConfig.dimensions.toMutableList() matrixValues = matrixWithAllocationConfig.matrixValues.toMutableList() - allocation = matrixWithAllocationConfig.allocation additionalProperties = matrixWithAllocationConfig.additionalProperties.toMutableMap() } + /** Allocation to be used to calculate the price */ + fun allocation(allocation: Double) = apply { this.allocation = allocation } + + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -4565,13 +4863,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -4582,9 +4873,6 @@ constructor( matrixValues = (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } - /** Allocation to be used to calculate the price */ - fun allocation(allocation: Double) = apply { this.allocation = allocation } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4609,14 +4897,14 @@ constructor( fun build(): MatrixWithAllocationConfig = MatrixWithAllocationConfig( - checkNotNull(dimensions) { "`dimensions` is required but was not set" } - .toImmutable(), + checkNotNull(allocation) { "`allocation` is required but was not set" }, checkNotNull(defaultUnitAmount) { "`defaultUnitAmount` is required but was not set" }, + checkNotNull(dimensions) { "`dimensions` is required but was not set" } + .toImmutable(), checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } .toImmutable(), - checkNotNull(allocation) { "`allocation` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -4625,15 +4913,12 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and an @@ -4642,6 +4927,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4655,20 +4943,17 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } - /** * One or two matrix keys to filter usage to this Matrix value by. For example, * ["region", "tier"] could be used to filter cloud usage by a cloud region and @@ -4688,6 +4973,9 @@ constructor( (dimensionValues ?: mutableListOf()).apply { add(dimensionValue) } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4712,11 +5000,11 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -4726,17 +5014,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -4744,17 +5032,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixWithAllocationConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && allocation == other.allocation && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithAllocationConfig && allocation == other.allocation && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, allocation, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allocation, defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithAllocationConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, allocation=$allocation, additionalProperties=$additionalProperties}" + "MatrixWithAllocationConfig{allocation=$allocation, defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -5202,65 +5490,64 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingMatrixWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixWithAllocationConfig == other.matrixWithAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingMatrixWithAllocationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && matrixWithAllocationConfig == other.matrixWithAllocationConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixWithAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithAllocationConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMatrixWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixWithAllocationConfig=$matrixWithAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingMatrixWithAllocationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixWithAllocationConfig=$matrixWithAllocationConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -5268,6 +5555,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -5276,14 +5576,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -5292,16 +5584,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -5316,120 +5604,192 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredConfig: TieredConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredConfig: TieredConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingTieredPrice: NewFloatingTieredPrice) = apply { - metadata = newFloatingTieredPrice.metadata - externalPriceId = newFloatingTieredPrice.externalPriceId + cadence = newFloatingTieredPrice.cadence + currency = newFloatingTieredPrice.currency + itemId = newFloatingTieredPrice.itemId + modelType = newFloatingTieredPrice.modelType name = newFloatingTieredPrice.name + tieredConfig = newFloatingTieredPrice.tieredConfig billableMetricId = newFloatingTieredPrice.billableMetricId - itemId = newFloatingTieredPrice.itemId billedInAdvance = newFloatingTieredPrice.billedInAdvance + billingCycleConfiguration = newFloatingTieredPrice.billingCycleConfiguration + conversionRate = newFloatingTieredPrice.conversionRate + externalPriceId = newFloatingTieredPrice.externalPriceId fixedPriceQuantity = newFloatingTieredPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingTieredPrice.invoiceGroupingKey - cadence = newFloatingTieredPrice.cadence - billingCycleConfiguration = newFloatingTieredPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingTieredPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredPrice.conversionRate - modelType = newFloatingTieredPrice.modelType - tieredConfig = newFloatingTieredPrice.tieredConfig - currency = newFloatingTieredPrice.currency + metadata = newFloatingTieredPrice.metadata additionalProperties = newFloatingTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredConfig(tieredConfig: TieredConfig) = apply { + this.tieredConfig = tieredConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredConfig(tieredConfig: TieredConfig) = apply { - this.tieredConfig = tieredConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5452,21 +5812,21 @@ constructor( fun build(): NewFloatingTieredPrice = NewFloatingTieredPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -5679,8 +6039,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("first_unit") private val firstUnit: Double, - @JsonProperty("last_unit") private val lastUnit: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("last_unit") private val lastUnit: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -5688,13 +6048,13 @@ constructor( /** Inclusive tier starting value */ @JsonProperty("first_unit") fun firstUnit(): Double = firstUnit + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Exclusive tier ending value. If null, this is treated as the last tier */ @JsonProperty("last_unit") fun lastUnit(): Optional = Optional.ofNullable(lastUnit) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5709,27 +6069,35 @@ constructor( class Builder { private var firstUnit: Double? = null - private var lastUnit: Double? = null private var unitAmount: String? = null + private var lastUnit: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } /** Inclusive tier starting value */ fun firstUnit(firstUnit: Double) = apply { this.firstUnit = firstUnit } - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: Double) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Exclusive tier ending value. If null, this is treated as the last tier */ + fun lastUnit(lastUnit: Double?) = apply { this.lastUnit = lastUnit } + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -5755,8 +6123,8 @@ constructor( fun build(): Tier = Tier( checkNotNull(firstUnit) { "`firstUnit` is required but was not set" }, - lastUnit, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + lastUnit, additionalProperties.toImmutable(), ) } @@ -5766,17 +6134,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -6191,65 +6559,64 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredConfig == other.tieredConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredConfig=$tieredConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_bps_config") fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -6257,6 +6624,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -6265,14 +6645,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -6281,16 +6653,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_bps_config") fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -6305,120 +6673,192 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredBpsConfig: TieredBpsConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredBpsConfig: TieredBpsConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = apply { - metadata = newFloatingTieredBpsPrice.metadata - externalPriceId = newFloatingTieredBpsPrice.externalPriceId + cadence = newFloatingTieredBpsPrice.cadence + currency = newFloatingTieredBpsPrice.currency + itemId = newFloatingTieredBpsPrice.itemId + modelType = newFloatingTieredBpsPrice.modelType name = newFloatingTieredBpsPrice.name + tieredBpsConfig = newFloatingTieredBpsPrice.tieredBpsConfig billableMetricId = newFloatingTieredBpsPrice.billableMetricId - itemId = newFloatingTieredBpsPrice.itemId billedInAdvance = newFloatingTieredBpsPrice.billedInAdvance + billingCycleConfiguration = newFloatingTieredBpsPrice.billingCycleConfiguration + conversionRate = newFloatingTieredBpsPrice.conversionRate + externalPriceId = newFloatingTieredBpsPrice.externalPriceId fixedPriceQuantity = newFloatingTieredBpsPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingTieredBpsPrice.invoiceGroupingKey - cadence = newFloatingTieredBpsPrice.cadence - billingCycleConfiguration = newFloatingTieredBpsPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingTieredBpsPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredBpsPrice.conversionRate - modelType = newFloatingTieredBpsPrice.modelType - tieredBpsConfig = newFloatingTieredBpsPrice.tieredBpsConfig - currency = newFloatingTieredBpsPrice.currency + metadata = newFloatingTieredBpsPrice.metadata additionalProperties = newFloatingTieredBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { + this.tieredBpsConfig = tieredBpsConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration + invoicingCycleConfiguration: InvoicingCycleConfiguration? ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { - this.tieredBpsConfig = tieredBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6441,23 +6881,23 @@ constructor( fun build(): NewFloatingTieredBpsPrice = NewFloatingTieredBpsPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredBpsConfig) { + "`tieredBpsConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredBpsConfig) { - "`tieredBpsConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -6677,14 +7117,17 @@ constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") private val bps: Double, @JsonProperty("minimum_amount") private val minimumAmount: String, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("bps") private val bps: Double, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + @JsonProperty("bps") fun bps(): Double = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount @@ -6692,9 +7135,6 @@ constructor( @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Per-event basis point rate */ - @JsonProperty("bps") fun bps(): Double = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -6712,39 +7152,47 @@ constructor( class Builder { + private var bps: Double? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var bps: Double? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6769,11 +7217,11 @@ constructor( fun build(): Tier = Tier( + checkNotNull(bps) { "`bps` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, maximumAmount, - checkNotNull(bps) { "`bps` is required but was not set" }, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -6784,17 +7232,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -7209,54 +7657,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredBpsConfig == other.tieredBpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredBpsPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredBpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredBpsConfig=$tieredBpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredBpsPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bps_config") private val bpsConfig: BpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bps_config") private val bpsConfig: BpsConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -7265,9 +7715,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -7275,6 +7722,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -7283,14 +7743,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -7299,16 +7751,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -7323,54 +7771,55 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bpsConfig: BpsConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bpsConfig: BpsConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingBpsPrice: NewFloatingBpsPrice) = apply { - metadata = newFloatingBpsPrice.metadata - externalPriceId = newFloatingBpsPrice.externalPriceId + bpsConfig = newFloatingBpsPrice.bpsConfig + cadence = newFloatingBpsPrice.cadence + currency = newFloatingBpsPrice.currency + itemId = newFloatingBpsPrice.itemId + modelType = newFloatingBpsPrice.modelType name = newFloatingBpsPrice.name billableMetricId = newFloatingBpsPrice.billableMetricId - itemId = newFloatingBpsPrice.itemId billedInAdvance = newFloatingBpsPrice.billedInAdvance + billingCycleConfiguration = newFloatingBpsPrice.billingCycleConfiguration + conversionRate = newFloatingBpsPrice.conversionRate + externalPriceId = newFloatingBpsPrice.externalPriceId fixedPriceQuantity = newFloatingBpsPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingBpsPrice.invoiceGroupingKey - cadence = newFloatingBpsPrice.cadence - billingCycleConfiguration = newFloatingBpsPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingBpsPrice.invoicingCycleConfiguration - conversionRate = newFloatingBpsPrice.conversionRate - modelType = newFloatingBpsPrice.modelType - bpsConfig = newFloatingBpsPrice.bpsConfig - currency = newFloatingBpsPrice.currency + metadata = newFloatingBpsPrice.metadata additionalProperties = newFloatingBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -7378,63 +7827,134 @@ constructor( /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7457,21 +7977,21 @@ constructor( fun build(): NewFloatingBpsPrice = NewFloatingBpsPrice( - metadata, - externalPriceId, + checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -7521,10 +8041,14 @@ constructor( fun bps(bps: Double) = apply { this.bps = bps } /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8099,54 +8623,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bpsConfig == other.bpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bpsConfig=$bpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -8155,9 +8681,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -8165,6 +8688,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -8173,14 +8709,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -8189,16 +8717,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -8213,120 +8737,192 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkBpsConfig: BulkBpsConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkBpsConfig: BulkBpsConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = apply { - metadata = newFloatingBulkBpsPrice.metadata - externalPriceId = newFloatingBulkBpsPrice.externalPriceId + bulkBpsConfig = newFloatingBulkBpsPrice.bulkBpsConfig + cadence = newFloatingBulkBpsPrice.cadence + currency = newFloatingBulkBpsPrice.currency + itemId = newFloatingBulkBpsPrice.itemId + modelType = newFloatingBulkBpsPrice.modelType name = newFloatingBulkBpsPrice.name billableMetricId = newFloatingBulkBpsPrice.billableMetricId - itemId = newFloatingBulkBpsPrice.itemId billedInAdvance = newFloatingBulkBpsPrice.billedInAdvance + billingCycleConfiguration = newFloatingBulkBpsPrice.billingCycleConfiguration + conversionRate = newFloatingBulkBpsPrice.conversionRate + externalPriceId = newFloatingBulkBpsPrice.externalPriceId fixedPriceQuantity = newFloatingBulkBpsPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingBulkBpsPrice.invoiceGroupingKey - cadence = newFloatingBulkBpsPrice.cadence - billingCycleConfiguration = newFloatingBulkBpsPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingBulkBpsPrice.invoicingCycleConfiguration - conversionRate = newFloatingBulkBpsPrice.conversionRate - modelType = newFloatingBulkBpsPrice.modelType - bulkBpsConfig = newFloatingBulkBpsPrice.bulkBpsConfig - currency = newFloatingBulkBpsPrice.currency + metadata = newFloatingBulkBpsPrice.metadata additionalProperties = newFloatingBulkBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { + this.bulkBpsConfig = bulkBpsConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { - this.bulkBpsConfig = bulkBpsConfig + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8349,21 +8945,21 @@ constructor( fun build(): NewFloatingBulkBpsPrice = NewFloatingBulkBpsPrice( - metadata, - externalPriceId, + checkNotNull(bulkBpsConfig) { "`bulkBpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkBpsConfig) { "`bulkBpsConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -8452,20 +9048,20 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("bps") private val bps: Double, + @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + @JsonProperty("bps") fun bps(): Double = bps + /** Upper bound for tier */ @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Basis points to rate on */ - @JsonProperty("bps") fun bps(): Double = bps - /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -8483,32 +9079,40 @@ constructor( class Builder { - private var maximumAmount: String? = null private var bps: Double? = null + private var maximumAmount: String? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8533,8 +9137,8 @@ constructor( fun build(): Tier = Tier( - maximumAmount, checkNotNull(bps) { "`bps` is required but was not set" }, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -8545,17 +9149,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -9102,54 +9706,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBulkBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkBpsConfig == other.bulkBpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkBpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBulkBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkBpsConfig=$bulkBpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -9158,9 +9764,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -9168,6 +9771,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -9176,14 +9792,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -9192,16 +9800,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -9216,54 +9820,55 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkConfig: BulkConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkConfig: BulkConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingBulkPrice: NewFloatingBulkPrice) = apply { - metadata = newFloatingBulkPrice.metadata - externalPriceId = newFloatingBulkPrice.externalPriceId + bulkConfig = newFloatingBulkPrice.bulkConfig + cadence = newFloatingBulkPrice.cadence + currency = newFloatingBulkPrice.currency + itemId = newFloatingBulkPrice.itemId + modelType = newFloatingBulkPrice.modelType name = newFloatingBulkPrice.name billableMetricId = newFloatingBulkPrice.billableMetricId - itemId = newFloatingBulkPrice.itemId billedInAdvance = newFloatingBulkPrice.billedInAdvance + billingCycleConfiguration = newFloatingBulkPrice.billingCycleConfiguration + conversionRate = newFloatingBulkPrice.conversionRate + externalPriceId = newFloatingBulkPrice.externalPriceId fixedPriceQuantity = newFloatingBulkPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingBulkPrice.invoiceGroupingKey - cadence = newFloatingBulkPrice.cadence - billingCycleConfiguration = newFloatingBulkPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingBulkPrice.invoicingCycleConfiguration - conversionRate = newFloatingBulkPrice.conversionRate - modelType = newFloatingBulkPrice.modelType - bulkConfig = newFloatingBulkPrice.bulkConfig - currency = newFloatingBulkPrice.currency + metadata = newFloatingBulkPrice.metadata additionalProperties = newFloatingBulkPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -9271,63 +9876,134 @@ constructor( /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * User-specified key/value pairs for the resource. 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 invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9350,21 +10026,21 @@ constructor( fun build(): NewFloatingBulkPrice = NewFloatingBulkPrice( - metadata, - externalPriceId, + checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -9444,19 +10120,19 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Upper bound for this tier */ @JsonProperty("maximum_units") fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -9470,24 +10146,32 @@ constructor( class Builder { - private var maximumUnits: Double? = null private var unitAmount: String? = null + private var maximumUnits: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = apply { + fun maximumUnits(maximumUnits: Double?) = apply { this.maximumUnits = maximumUnits } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = maximumUnits(maximumUnits as Double?) + + /** Upper bound for this tier */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9513,8 +10197,8 @@ constructor( fun build(): Tier = Tier( - maximumUnits, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -9524,17 +10208,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -10081,66 +10765,66 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBulkPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkConfig == other.bulkConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBulkPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkConfig=$bulkConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("threshold_total_amount_config") + private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("threshold_total_amount_config") - private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("threshold_total_amount_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = thresholdTotalAmountConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -10148,6 +10832,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -10156,14 +10853,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -10172,17 +10861,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("threshold_total_amount_config") - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = thresholdTotalAmountConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -10197,127 +10881,199 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice ) = apply { - metadata = newFloatingThresholdTotalAmountPrice.metadata - externalPriceId = newFloatingThresholdTotalAmountPrice.externalPriceId + cadence = newFloatingThresholdTotalAmountPrice.cadence + currency = newFloatingThresholdTotalAmountPrice.currency + itemId = newFloatingThresholdTotalAmountPrice.itemId + modelType = newFloatingThresholdTotalAmountPrice.modelType name = newFloatingThresholdTotalAmountPrice.name + thresholdTotalAmountConfig = + newFloatingThresholdTotalAmountPrice.thresholdTotalAmountConfig billableMetricId = newFloatingThresholdTotalAmountPrice.billableMetricId - itemId = newFloatingThresholdTotalAmountPrice.itemId billedInAdvance = newFloatingThresholdTotalAmountPrice.billedInAdvance - fixedPriceQuantity = newFloatingThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingThresholdTotalAmountPrice.invoiceGroupingKey - cadence = newFloatingThresholdTotalAmountPrice.cadence billingCycleConfiguration = newFloatingThresholdTotalAmountPrice.billingCycleConfiguration + conversionRate = newFloatingThresholdTotalAmountPrice.conversionRate + externalPriceId = newFloatingThresholdTotalAmountPrice.externalPriceId + fixedPriceQuantity = newFloatingThresholdTotalAmountPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingThresholdTotalAmountPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingThresholdTotalAmountPrice.invoicingCycleConfiguration - conversionRate = newFloatingThresholdTotalAmountPrice.conversionRate - modelType = newFloatingThresholdTotalAmountPrice.modelType - thresholdTotalAmountConfig = - newFloatingThresholdTotalAmountPrice.thresholdTotalAmountConfig - currency = newFloatingThresholdTotalAmountPrice.currency + metadata = newFloatingThresholdTotalAmountPrice.metadata additionalProperties = newFloatingThresholdTotalAmountPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun thresholdTotalAmountConfig(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = + apply { + this.thresholdTotalAmountConfig = thresholdTotalAmountConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun thresholdTotalAmountConfig(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = - apply { - this.thresholdTotalAmountConfig = thresholdTotalAmountConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10340,23 +11096,23 @@ constructor( fun build(): NewFloatingThresholdTotalAmountPrice = NewFloatingThresholdTotalAmountPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(thresholdTotalAmountConfig) { + "`thresholdTotalAmountConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(thresholdTotalAmountConfig) { - "`thresholdTotalAmountConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -10960,65 +11716,65 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingThresholdTotalAmountPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingThresholdTotalAmountPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, thresholdTotalAmountConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingThresholdTotalAmountPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingThresholdTotalAmountPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_config") private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_config") private val tieredPackageConfig: TieredPackageConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_config") + fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -11026,6 +11782,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -11034,14 +11803,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -11050,17 +11811,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_config") - fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -11075,124 +11831,196 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageConfig: TieredPackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageConfig: TieredPackageConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice) = apply { - metadata = newFloatingTieredPackagePrice.metadata - externalPriceId = newFloatingTieredPackagePrice.externalPriceId + cadence = newFloatingTieredPackagePrice.cadence + currency = newFloatingTieredPackagePrice.currency + itemId = newFloatingTieredPackagePrice.itemId + modelType = newFloatingTieredPackagePrice.modelType name = newFloatingTieredPackagePrice.name + tieredPackageConfig = newFloatingTieredPackagePrice.tieredPackageConfig billableMetricId = newFloatingTieredPackagePrice.billableMetricId - itemId = newFloatingTieredPackagePrice.itemId billedInAdvance = newFloatingTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPackagePrice.invoiceGroupingKey - cadence = newFloatingTieredPackagePrice.cadence billingCycleConfiguration = newFloatingTieredPackagePrice.billingCycleConfiguration + conversionRate = newFloatingTieredPackagePrice.conversionRate + externalPriceId = newFloatingTieredPackagePrice.externalPriceId + fixedPriceQuantity = newFloatingTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredPackagePrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredPackagePrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredPackagePrice.conversionRate - modelType = newFloatingTieredPackagePrice.modelType - tieredPackageConfig = newFloatingTieredPackagePrice.tieredPackageConfig - currency = newFloatingTieredPackagePrice.currency + metadata = newFloatingTieredPackagePrice.metadata additionalProperties = newFloatingTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { + this.tieredPackageConfig = tieredPackageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { - this.tieredPackageConfig = tieredPackageConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11215,23 +12043,23 @@ constructor( fun build(): NewFloatingTieredPackagePrice = NewFloatingTieredPackagePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredPackageConfig) { + "`tieredPackageConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredPackageConfig) { - "`tieredPackageConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -11834,54 +12662,57 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageConfig == other.tieredPackageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPackagePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageConfig=$tieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredPackagePrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_tiered_config") private val groupedTieredConfig: GroupedTieredConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_tiered_config") private val groupedTieredConfig: GroupedTieredConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_tiered_config") + fun groupedTieredConfig(): GroupedTieredConfig = groupedTieredConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -11890,9 +12721,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -11900,6 +12728,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -11908,14 +12749,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -11924,17 +12757,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_tiered_config") - fun groupedTieredConfig(): GroupedTieredConfig = groupedTieredConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -11949,124 +12777,196 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedTieredConfig: GroupedTieredConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedTieredConfig: GroupedTieredConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice) = apply { - metadata = newFloatingGroupedTieredPrice.metadata - externalPriceId = newFloatingGroupedTieredPrice.externalPriceId + cadence = newFloatingGroupedTieredPrice.cadence + currency = newFloatingGroupedTieredPrice.currency + groupedTieredConfig = newFloatingGroupedTieredPrice.groupedTieredConfig + itemId = newFloatingGroupedTieredPrice.itemId + modelType = newFloatingGroupedTieredPrice.modelType name = newFloatingGroupedTieredPrice.name billableMetricId = newFloatingGroupedTieredPrice.billableMetricId - itemId = newFloatingGroupedTieredPrice.itemId billedInAdvance = newFloatingGroupedTieredPrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPrice.invoiceGroupingKey - cadence = newFloatingGroupedTieredPrice.cadence billingCycleConfiguration = newFloatingGroupedTieredPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedTieredPrice.conversionRate + externalPriceId = newFloatingGroupedTieredPrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedTieredPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedTieredPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedTieredPrice.conversionRate - modelType = newFloatingGroupedTieredPrice.modelType - groupedTieredConfig = newFloatingGroupedTieredPrice.groupedTieredConfig - currency = newFloatingGroupedTieredPrice.currency + metadata = newFloatingGroupedTieredPrice.metadata additionalProperties = newFloatingGroupedTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = apply { + this.groupedTieredConfig = groupedTieredConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = apply { - this.groupedTieredConfig = groupedTieredConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12089,23 +12989,23 @@ constructor( fun build(): NewFloatingGroupedTieredPrice = NewFloatingGroupedTieredPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedTieredConfig) { + "`groupedTieredConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedTieredConfig) { - "`groupedTieredConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -12708,66 +13608,66 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedTieredConfig == other.groupedTieredConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedTieredPrice && cadence == other.cadence && currency == other.currency && groupedTieredConfig == other.groupedTieredConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredConfig=$groupedTieredConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedTieredPrice{cadence=$cadence, currency=$currency, groupedTieredConfig=$groupedTieredConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_minimum_config") + private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_minimum_config") - private val tieredWithMinimumConfig: TieredWithMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_minimum_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -12775,6 +13675,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -12783,14 +13696,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -12799,17 +13704,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_minimum_config") - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -12824,125 +13724,197 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice ) = apply { - metadata = newFloatingTieredWithMinimumPrice.metadata - externalPriceId = newFloatingTieredWithMinimumPrice.externalPriceId + cadence = newFloatingTieredWithMinimumPrice.cadence + currency = newFloatingTieredWithMinimumPrice.currency + itemId = newFloatingTieredWithMinimumPrice.itemId + modelType = newFloatingTieredWithMinimumPrice.modelType name = newFloatingTieredWithMinimumPrice.name + tieredWithMinimumConfig = newFloatingTieredWithMinimumPrice.tieredWithMinimumConfig billableMetricId = newFloatingTieredWithMinimumPrice.billableMetricId - itemId = newFloatingTieredWithMinimumPrice.itemId billedInAdvance = newFloatingTieredWithMinimumPrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithMinimumPrice.invoiceGroupingKey - cadence = newFloatingTieredWithMinimumPrice.cadence billingCycleConfiguration = newFloatingTieredWithMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingTieredWithMinimumPrice.conversionRate + externalPriceId = newFloatingTieredWithMinimumPrice.externalPriceId + fixedPriceQuantity = newFloatingTieredWithMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredWithMinimumPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredWithMinimumPrice.conversionRate - modelType = newFloatingTieredWithMinimumPrice.modelType - tieredWithMinimumConfig = newFloatingTieredWithMinimumPrice.tieredWithMinimumConfig - currency = newFloatingTieredWithMinimumPrice.currency + metadata = newFloatingTieredWithMinimumPrice.metadata additionalProperties = newFloatingTieredWithMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = apply { + this.tieredWithMinimumConfig = tieredWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = apply { - this.tieredWithMinimumConfig = tieredWithMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12965,23 +13937,23 @@ constructor( fun build(): NewFloatingTieredWithMinimumPrice = NewFloatingTieredWithMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredWithMinimumConfig) { + "`tieredWithMinimumConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredWithMinimumConfig) { - "`tieredWithMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -13585,66 +14557,66 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredWithMinimumPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithMinimumConfig=$tieredWithMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredWithMinimumPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingPackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_with_allocation_config") + private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_with_allocation_config") - private val packageWithAllocationConfig: PackageWithAllocationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_with_allocation_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = packageWithAllocationConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -13652,6 +14624,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -13660,14 +14645,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -13676,17 +14653,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_with_allocation_config") - fun packageWithAllocationConfig(): PackageWithAllocationConfig = packageWithAllocationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -13701,126 +14673,198 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageWithAllocationConfig: PackageWithAllocationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice ) = apply { - metadata = newFloatingPackageWithAllocationPrice.metadata - externalPriceId = newFloatingPackageWithAllocationPrice.externalPriceId + cadence = newFloatingPackageWithAllocationPrice.cadence + currency = newFloatingPackageWithAllocationPrice.currency + itemId = newFloatingPackageWithAllocationPrice.itemId + modelType = newFloatingPackageWithAllocationPrice.modelType name = newFloatingPackageWithAllocationPrice.name + packageWithAllocationConfig = + newFloatingPackageWithAllocationPrice.packageWithAllocationConfig billableMetricId = newFloatingPackageWithAllocationPrice.billableMetricId - itemId = newFloatingPackageWithAllocationPrice.itemId billedInAdvance = newFloatingPackageWithAllocationPrice.billedInAdvance - fixedPriceQuantity = newFloatingPackageWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingPackageWithAllocationPrice.invoiceGroupingKey - cadence = newFloatingPackageWithAllocationPrice.cadence billingCycleConfiguration = newFloatingPackageWithAllocationPrice.billingCycleConfiguration + conversionRate = newFloatingPackageWithAllocationPrice.conversionRate + externalPriceId = newFloatingPackageWithAllocationPrice.externalPriceId + fixedPriceQuantity = newFloatingPackageWithAllocationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingPackageWithAllocationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingPackageWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newFloatingPackageWithAllocationPrice.conversionRate - modelType = newFloatingPackageWithAllocationPrice.modelType - packageWithAllocationConfig = - newFloatingPackageWithAllocationPrice.packageWithAllocationConfig - currency = newFloatingPackageWithAllocationPrice.currency + metadata = newFloatingPackageWithAllocationPrice.metadata additionalProperties = newFloatingPackageWithAllocationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -13843,23 +14887,23 @@ constructor( fun build(): NewFloatingPackageWithAllocationPrice = NewFloatingPackageWithAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(packageWithAllocationConfig) { + "`packageWithAllocationConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(packageWithAllocationConfig) { - "`packageWithAllocationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -14464,66 +15508,67 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingPackageWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageWithAllocationConfig == other.packageWithAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingPackageWithAllocationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageWithAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingPackageWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageWithAllocationConfig=$packageWithAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingPackageWithAllocationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredPackageWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_with_minimum_config") + private val tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_with_minimum_config") - private val tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_with_minimum_config") + fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = + tieredPackageWithMinimumConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -14531,6 +15576,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -14539,14 +15597,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -14555,18 +15605,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_with_minimum_config") - fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = - tieredPackageWithMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -14581,126 +15625,198 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice ) = apply { - metadata = newFloatingTieredPackageWithMinimumPrice.metadata - externalPriceId = newFloatingTieredPackageWithMinimumPrice.externalPriceId + cadence = newFloatingTieredPackageWithMinimumPrice.cadence + currency = newFloatingTieredPackageWithMinimumPrice.currency + itemId = newFloatingTieredPackageWithMinimumPrice.itemId + modelType = newFloatingTieredPackageWithMinimumPrice.modelType name = newFloatingTieredPackageWithMinimumPrice.name + tieredPackageWithMinimumConfig = + newFloatingTieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig billableMetricId = newFloatingTieredPackageWithMinimumPrice.billableMetricId - itemId = newFloatingTieredPackageWithMinimumPrice.itemId billedInAdvance = newFloatingTieredPackageWithMinimumPrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredPackageWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPackageWithMinimumPrice.invoiceGroupingKey - cadence = newFloatingTieredPackageWithMinimumPrice.cadence billingCycleConfiguration = newFloatingTieredPackageWithMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingTieredPackageWithMinimumPrice.conversionRate + externalPriceId = newFloatingTieredPackageWithMinimumPrice.externalPriceId + fixedPriceQuantity = newFloatingTieredPackageWithMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredPackageWithMinimumPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredPackageWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredPackageWithMinimumPrice.conversionRate - modelType = newFloatingTieredPackageWithMinimumPrice.modelType - tieredPackageWithMinimumConfig = - newFloatingTieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig - currency = newFloatingTieredPackageWithMinimumPrice.currency + metadata = newFloatingTieredPackageWithMinimumPrice.metadata additionalProperties = newFloatingTieredPackageWithMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageWithMinimumConfig( + tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig + ) = apply { this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredPackageWithMinimumConfig( - tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig - ) = apply { this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -14723,23 +15839,23 @@ constructor( fun build(): NewFloatingTieredPackageWithMinimumPrice = NewFloatingTieredPackageWithMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredPackageWithMinimumConfig) { + "`tieredPackageWithMinimumConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredPackageWithMinimumConfig) { - "`tieredPackageWithMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -15344,66 +16460,66 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredPackageWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPackageWithMinimumPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageWithMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredPackageWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredPackageWithMinimumPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingUnitWithPercentPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_percent_config") + private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_percent_config") - private val unitWithPercentConfig: UnitWithPercentConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_percent_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -15411,6 +16527,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -15419,14 +16548,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -15435,17 +16556,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_percent_config") - fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -15460,124 +16576,196 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithPercentConfig: UnitWithPercentConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithPercentConfig: UnitWithPercentConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice) = apply { - metadata = newFloatingUnitWithPercentPrice.metadata - externalPriceId = newFloatingUnitWithPercentPrice.externalPriceId + cadence = newFloatingUnitWithPercentPrice.cadence + currency = newFloatingUnitWithPercentPrice.currency + itemId = newFloatingUnitWithPercentPrice.itemId + modelType = newFloatingUnitWithPercentPrice.modelType name = newFloatingUnitWithPercentPrice.name + unitWithPercentConfig = newFloatingUnitWithPercentPrice.unitWithPercentConfig billableMetricId = newFloatingUnitWithPercentPrice.billableMetricId - itemId = newFloatingUnitWithPercentPrice.itemId billedInAdvance = newFloatingUnitWithPercentPrice.billedInAdvance - fixedPriceQuantity = newFloatingUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithPercentPrice.invoiceGroupingKey - cadence = newFloatingUnitWithPercentPrice.cadence billingCycleConfiguration = newFloatingUnitWithPercentPrice.billingCycleConfiguration + conversionRate = newFloatingUnitWithPercentPrice.conversionRate + externalPriceId = newFloatingUnitWithPercentPrice.externalPriceId + fixedPriceQuantity = newFloatingUnitWithPercentPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingUnitWithPercentPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingUnitWithPercentPrice.invoicingCycleConfiguration - conversionRate = newFloatingUnitWithPercentPrice.conversionRate - modelType = newFloatingUnitWithPercentPrice.modelType - unitWithPercentConfig = newFloatingUnitWithPercentPrice.unitWithPercentConfig - currency = newFloatingUnitWithPercentPrice.currency + metadata = newFloatingUnitWithPercentPrice.metadata additionalProperties = newFloatingUnitWithPercentPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = apply { + this.unitWithPercentConfig = unitWithPercentConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = apply { - this.unitWithPercentConfig = unitWithPercentConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -15600,23 +16788,23 @@ constructor( fun build(): NewFloatingUnitWithPercentPrice = NewFloatingUnitWithPercentPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitWithPercentConfig) { + "`unitWithPercentConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitWithPercentConfig) { - "`unitWithPercentConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -16219,66 +17407,66 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingUnitWithPercentPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithPercentConfig == other.unitWithPercentConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingUnitWithPercentPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithPercentConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingUnitWithPercentPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithPercentConfig=$unitWithPercentConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingUnitWithPercentPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_proration_config") + private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_proration_config") - private val tieredWithProrationConfig: TieredWithProrationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_proration_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = tieredWithProrationConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -16286,6 +17474,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -16294,14 +17495,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -16310,17 +17503,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_proration_config") - fun tieredWithProrationConfig(): TieredWithProrationConfig = tieredWithProrationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -16335,127 +17523,199 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithProrationConfig: TieredWithProrationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice ) = apply { - metadata = newFloatingTieredWithProrationPrice.metadata - externalPriceId = newFloatingTieredWithProrationPrice.externalPriceId + cadence = newFloatingTieredWithProrationPrice.cadence + currency = newFloatingTieredWithProrationPrice.currency + itemId = newFloatingTieredWithProrationPrice.itemId + modelType = newFloatingTieredWithProrationPrice.modelType name = newFloatingTieredWithProrationPrice.name + tieredWithProrationConfig = + newFloatingTieredWithProrationPrice.tieredWithProrationConfig billableMetricId = newFloatingTieredWithProrationPrice.billableMetricId - itemId = newFloatingTieredWithProrationPrice.itemId billedInAdvance = newFloatingTieredWithProrationPrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithProrationPrice.invoiceGroupingKey - cadence = newFloatingTieredWithProrationPrice.cadence billingCycleConfiguration = newFloatingTieredWithProrationPrice.billingCycleConfiguration + conversionRate = newFloatingTieredWithProrationPrice.conversionRate + externalPriceId = newFloatingTieredWithProrationPrice.externalPriceId + fixedPriceQuantity = newFloatingTieredWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredWithProrationPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredWithProrationPrice.conversionRate - modelType = newFloatingTieredWithProrationPrice.modelType - tieredWithProrationConfig = - newFloatingTieredWithProrationPrice.tieredWithProrationConfig - currency = newFloatingTieredWithProrationPrice.currency + metadata = newFloatingTieredWithProrationPrice.metadata additionalProperties = newFloatingTieredWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = + apply { + this.tieredWithProrationConfig = tieredWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = - apply { - this.tieredWithProrationConfig = tieredWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16478,23 +17738,23 @@ constructor( fun build(): NewFloatingTieredWithProrationPrice = NewFloatingTieredWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredWithProrationConfig) { + "`tieredWithProrationConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredWithProrationConfig) { - "`tieredWithProrationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -17098,66 +18358,66 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithProrationConfig == other.tieredWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredWithProrationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithProrationConfig=$tieredWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredWithProrationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingUnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_proration_config") + private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_proration_config") - private val unitWithProrationConfig: UnitWithProrationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -17165,6 +18425,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -17173,14 +18446,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -17189,17 +18454,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_proration_config") - fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -17214,125 +18474,197 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithProrationConfig: UnitWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithProrationConfig: UnitWithProrationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice ) = apply { - metadata = newFloatingUnitWithProrationPrice.metadata - externalPriceId = newFloatingUnitWithProrationPrice.externalPriceId + cadence = newFloatingUnitWithProrationPrice.cadence + currency = newFloatingUnitWithProrationPrice.currency + itemId = newFloatingUnitWithProrationPrice.itemId + modelType = newFloatingUnitWithProrationPrice.modelType name = newFloatingUnitWithProrationPrice.name + unitWithProrationConfig = newFloatingUnitWithProrationPrice.unitWithProrationConfig billableMetricId = newFloatingUnitWithProrationPrice.billableMetricId - itemId = newFloatingUnitWithProrationPrice.itemId billedInAdvance = newFloatingUnitWithProrationPrice.billedInAdvance - fixedPriceQuantity = newFloatingUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithProrationPrice.invoiceGroupingKey - cadence = newFloatingUnitWithProrationPrice.cadence billingCycleConfiguration = newFloatingUnitWithProrationPrice.billingCycleConfiguration + conversionRate = newFloatingUnitWithProrationPrice.conversionRate + externalPriceId = newFloatingUnitWithProrationPrice.externalPriceId + fixedPriceQuantity = newFloatingUnitWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingUnitWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingUnitWithProrationPrice.invoicingCycleConfiguration - conversionRate = newFloatingUnitWithProrationPrice.conversionRate - modelType = newFloatingUnitWithProrationPrice.modelType - unitWithProrationConfig = newFloatingUnitWithProrationPrice.unitWithProrationConfig - currency = newFloatingUnitWithProrationPrice.currency + metadata = newFloatingUnitWithProrationPrice.metadata additionalProperties = newFloatingUnitWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = apply { + this.unitWithProrationConfig = unitWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = apply { - this.unitWithProrationConfig = unitWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -17355,23 +18687,23 @@ constructor( fun build(): NewFloatingUnitWithProrationPrice = NewFloatingUnitWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitWithProrationConfig) { + "`unitWithProrationConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitWithProrationConfig) { - "`unitWithProrationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -17975,55 +19307,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingUnitWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithProrationConfig == other.unitWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingUnitWithProrationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingUnitWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithProrationConfig=$unitWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingUnitWithProrationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_allocation_config") + private val groupedAllocationConfig: GroupedAllocationConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_allocation_config") - private val groupedAllocationConfig: GroupedAllocationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_allocation_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -18032,9 +19367,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -18042,6 +19374,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -18050,14 +19395,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -18066,17 +19403,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_allocation_config") - fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -18091,125 +19423,197 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedAllocationConfig: GroupedAllocationConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedAllocationConfig: GroupedAllocationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice ) = apply { - metadata = newFloatingGroupedAllocationPrice.metadata - externalPriceId = newFloatingGroupedAllocationPrice.externalPriceId + cadence = newFloatingGroupedAllocationPrice.cadence + currency = newFloatingGroupedAllocationPrice.currency + groupedAllocationConfig = newFloatingGroupedAllocationPrice.groupedAllocationConfig + itemId = newFloatingGroupedAllocationPrice.itemId + modelType = newFloatingGroupedAllocationPrice.modelType name = newFloatingGroupedAllocationPrice.name billableMetricId = newFloatingGroupedAllocationPrice.billableMetricId - itemId = newFloatingGroupedAllocationPrice.itemId billedInAdvance = newFloatingGroupedAllocationPrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedAllocationPrice.invoiceGroupingKey - cadence = newFloatingGroupedAllocationPrice.cadence billingCycleConfiguration = newFloatingGroupedAllocationPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedAllocationPrice.conversionRate + externalPriceId = newFloatingGroupedAllocationPrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedAllocationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedAllocationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedAllocationPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedAllocationPrice.conversionRate - modelType = newFloatingGroupedAllocationPrice.modelType - groupedAllocationConfig = newFloatingGroupedAllocationPrice.groupedAllocationConfig - currency = newFloatingGroupedAllocationPrice.currency + metadata = newFloatingGroupedAllocationPrice.metadata additionalProperties = newFloatingGroupedAllocationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = apply { + this.groupedAllocationConfig = groupedAllocationConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = apply { - this.groupedAllocationConfig = groupedAllocationConfig + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -18232,23 +19636,23 @@ constructor( fun build(): NewFloatingGroupedAllocationPrice = NewFloatingGroupedAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedAllocationConfig) { + "`groupedAllocationConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedAllocationConfig) { - "`groupedAllocationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -18852,55 +20256,59 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedAllocationConfig == other.groupedAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedAllocationPrice && cadence == other.cadence && currency == other.currency && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedAllocationConfig=$groupedAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedAllocationPrice{cadence=$cadence, currency=$currency, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_with_prorated_minimum_config") + private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_prorated_minimum_config") - private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_with_prorated_minimum_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -18909,9 +20317,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -18919,6 +20324,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -18927,14 +20345,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -18943,18 +20353,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_prorated_minimum_config") - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -18969,21 +20373,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -18991,39 +20395,42 @@ constructor( newFloatingGroupedWithProratedMinimumPrice: NewFloatingGroupedWithProratedMinimumPrice ) = apply { - metadata = newFloatingGroupedWithProratedMinimumPrice.metadata - externalPriceId = newFloatingGroupedWithProratedMinimumPrice.externalPriceId + cadence = newFloatingGroupedWithProratedMinimumPrice.cadence + currency = newFloatingGroupedWithProratedMinimumPrice.currency + groupedWithProratedMinimumConfig = + newFloatingGroupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig + itemId = newFloatingGroupedWithProratedMinimumPrice.itemId + modelType = newFloatingGroupedWithProratedMinimumPrice.modelType name = newFloatingGroupedWithProratedMinimumPrice.name billableMetricId = newFloatingGroupedWithProratedMinimumPrice.billableMetricId - itemId = newFloatingGroupedWithProratedMinimumPrice.itemId billedInAdvance = newFloatingGroupedWithProratedMinimumPrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedWithProratedMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedWithProratedMinimumPrice.invoiceGroupingKey - cadence = newFloatingGroupedWithProratedMinimumPrice.cadence billingCycleConfiguration = newFloatingGroupedWithProratedMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedWithProratedMinimumPrice.conversionRate + externalPriceId = newFloatingGroupedWithProratedMinimumPrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedWithProratedMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedWithProratedMinimumPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedWithProratedMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedWithProratedMinimumPrice.conversionRate - modelType = newFloatingGroupedWithProratedMinimumPrice.modelType - groupedWithProratedMinimumConfig = - newFloatingGroupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig - currency = newFloatingGroupedWithProratedMinimumPrice.currency + metadata = newFloatingGroupedWithProratedMinimumPrice.metadata additionalProperties = newFloatingGroupedWithProratedMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -19031,65 +20438,134 @@ constructor( /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19112,23 +20588,23 @@ constructor( fun build(): NewFloatingGroupedWithProratedMinimumPrice = NewFloatingGroupedWithProratedMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedWithProratedMinimumConfig) { + "`groupedWithProratedMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithProratedMinimumConfig) { - "`groupedWithProratedMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -19734,55 +21210,59 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedWithProratedMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedWithProratedMinimumPrice && cadence == other.cadence && currency == other.currency && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithProratedMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedWithProratedMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedWithProratedMinimumPrice{cadence=$cadence, currency=$currency, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedWithMeteredMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_with_metered_minimum_config") + private val groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_metered_minimum_config") - private val groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_with_metered_minimum_config") + fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -19791,9 +21271,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -19801,6 +21278,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -19809,14 +21299,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -19825,18 +21307,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_metered_minimum_config") - fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -19851,60 +21327,63 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingGroupedWithMeteredMinimumPrice: NewFloatingGroupedWithMeteredMinimumPrice ) = apply { - metadata = newFloatingGroupedWithMeteredMinimumPrice.metadata - externalPriceId = newFloatingGroupedWithMeteredMinimumPrice.externalPriceId + cadence = newFloatingGroupedWithMeteredMinimumPrice.cadence + currency = newFloatingGroupedWithMeteredMinimumPrice.currency + groupedWithMeteredMinimumConfig = + newFloatingGroupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig + itemId = newFloatingGroupedWithMeteredMinimumPrice.itemId + modelType = newFloatingGroupedWithMeteredMinimumPrice.modelType name = newFloatingGroupedWithMeteredMinimumPrice.name billableMetricId = newFloatingGroupedWithMeteredMinimumPrice.billableMetricId - itemId = newFloatingGroupedWithMeteredMinimumPrice.itemId billedInAdvance = newFloatingGroupedWithMeteredMinimumPrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedWithMeteredMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedWithMeteredMinimumPrice.invoiceGroupingKey - cadence = newFloatingGroupedWithMeteredMinimumPrice.cadence billingCycleConfiguration = newFloatingGroupedWithMeteredMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedWithMeteredMinimumPrice.conversionRate + externalPriceId = newFloatingGroupedWithMeteredMinimumPrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedWithMeteredMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedWithMeteredMinimumPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedWithMeteredMinimumPrice.conversionRate - modelType = newFloatingGroupedWithMeteredMinimumPrice.modelType - groupedWithMeteredMinimumConfig = - newFloatingGroupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig - currency = newFloatingGroupedWithMeteredMinimumPrice.currency + metadata = newFloatingGroupedWithMeteredMinimumPrice.metadata additionalProperties = newFloatingGroupedWithMeteredMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -19912,65 +21391,134 @@ constructor( /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19993,23 +21541,23 @@ constructor( fun build(): NewFloatingGroupedWithMeteredMinimumPrice = NewFloatingGroupedWithMeteredMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedWithMeteredMinimumConfig) { + "`groupedWithMeteredMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithMeteredMinimumConfig) { - "`groupedWithMeteredMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -20615,55 +22163,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedWithMeteredMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedWithMeteredMinimumPrice && cadence == other.cadence && currency == other.currency && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithMeteredMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithMeteredMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedWithMeteredMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedWithMeteredMinimumPrice{cadence=$cadence, currency=$currency, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingMatrixWithDisplayNamePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_with_display_name_config") + private val matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_with_display_name_config") - private val matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_with_display_name_config") + fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = matrixWithDisplayNameConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -20672,9 +22223,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -20682,6 +22230,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -20690,14 +22251,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -20706,17 +22259,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_with_display_name_config") - fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = matrixWithDisplayNameConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -20731,60 +22279,63 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice ) = apply { - metadata = newFloatingMatrixWithDisplayNamePrice.metadata - externalPriceId = newFloatingMatrixWithDisplayNamePrice.externalPriceId + cadence = newFloatingMatrixWithDisplayNamePrice.cadence + currency = newFloatingMatrixWithDisplayNamePrice.currency + itemId = newFloatingMatrixWithDisplayNamePrice.itemId + matrixWithDisplayNameConfig = + newFloatingMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig + modelType = newFloatingMatrixWithDisplayNamePrice.modelType name = newFloatingMatrixWithDisplayNamePrice.name billableMetricId = newFloatingMatrixWithDisplayNamePrice.billableMetricId - itemId = newFloatingMatrixWithDisplayNamePrice.itemId billedInAdvance = newFloatingMatrixWithDisplayNamePrice.billedInAdvance - fixedPriceQuantity = newFloatingMatrixWithDisplayNamePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixWithDisplayNamePrice.invoiceGroupingKey - cadence = newFloatingMatrixWithDisplayNamePrice.cadence billingCycleConfiguration = newFloatingMatrixWithDisplayNamePrice.billingCycleConfiguration + conversionRate = newFloatingMatrixWithDisplayNamePrice.conversionRate + externalPriceId = newFloatingMatrixWithDisplayNamePrice.externalPriceId + fixedPriceQuantity = newFloatingMatrixWithDisplayNamePrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingMatrixWithDisplayNamePrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingMatrixWithDisplayNamePrice.invoicingCycleConfiguration - conversionRate = newFloatingMatrixWithDisplayNamePrice.conversionRate - modelType = newFloatingMatrixWithDisplayNamePrice.modelType - matrixWithDisplayNameConfig = - newFloatingMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - currency = newFloatingMatrixWithDisplayNamePrice.currency + metadata = newFloatingMatrixWithDisplayNamePrice.metadata additionalProperties = newFloatingMatrixWithDisplayNamePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig + ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -20792,65 +22343,134 @@ constructor( /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig - ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20873,23 +22493,23 @@ constructor( fun build(): NewFloatingMatrixWithDisplayNamePrice = NewFloatingMatrixWithDisplayNamePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixWithDisplayNameConfig) { + "`matrixWithDisplayNameConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixWithDisplayNameConfig) { - "`matrixWithDisplayNameConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -21494,55 +23114,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingMatrixWithDisplayNamePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingMatrixWithDisplayNamePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixWithDisplayNameConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithDisplayNameConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMatrixWithDisplayNamePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingMatrixWithDisplayNamePrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_with_proration_config") + private val bulkWithProrationConfig: BulkWithProrationConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_with_proration_config") - private val bulkWithProrationConfig: BulkWithProrationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_with_proration_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -21551,9 +23174,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -21561,6 +23181,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -21569,14 +23202,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -21585,17 +23210,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_with_proration_config") - fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -21610,125 +23230,197 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkWithProrationConfig: BulkWithProrationConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkWithProrationConfig: BulkWithProrationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice ) = apply { - metadata = newFloatingBulkWithProrationPrice.metadata - externalPriceId = newFloatingBulkWithProrationPrice.externalPriceId + bulkWithProrationConfig = newFloatingBulkWithProrationPrice.bulkWithProrationConfig + cadence = newFloatingBulkWithProrationPrice.cadence + currency = newFloatingBulkWithProrationPrice.currency + itemId = newFloatingBulkWithProrationPrice.itemId + modelType = newFloatingBulkWithProrationPrice.modelType name = newFloatingBulkWithProrationPrice.name billableMetricId = newFloatingBulkWithProrationPrice.billableMetricId - itemId = newFloatingBulkWithProrationPrice.itemId billedInAdvance = newFloatingBulkWithProrationPrice.billedInAdvance - fixedPriceQuantity = newFloatingBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkWithProrationPrice.invoiceGroupingKey - cadence = newFloatingBulkWithProrationPrice.cadence billingCycleConfiguration = newFloatingBulkWithProrationPrice.billingCycleConfiguration + conversionRate = newFloatingBulkWithProrationPrice.conversionRate + externalPriceId = newFloatingBulkWithProrationPrice.externalPriceId + fixedPriceQuantity = newFloatingBulkWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingBulkWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingBulkWithProrationPrice.invoicingCycleConfiguration - conversionRate = newFloatingBulkWithProrationPrice.conversionRate - modelType = newFloatingBulkWithProrationPrice.modelType - bulkWithProrationConfig = newFloatingBulkWithProrationPrice.bulkWithProrationConfig - currency = newFloatingBulkWithProrationPrice.currency + metadata = newFloatingBulkWithProrationPrice.metadata additionalProperties = newFloatingBulkWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = apply { + this.bulkWithProrationConfig = bulkWithProrationConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = apply { - this.bulkWithProrationConfig = bulkWithProrationConfig + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -21751,23 +23443,23 @@ constructor( fun build(): NewFloatingBulkWithProrationPrice = NewFloatingBulkWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(bulkWithProrationConfig) { "`bulkWithProrationConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } @@ -22371,55 +24063,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBulkWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkWithProrationConfig == other.bulkWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_tiered_package_config") + private val groupedTieredPackageConfig: GroupedTieredPackageConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_tiered_package_config") - private val groupedTieredPackageConfig: GroupedTieredPackageConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_tiered_package_config") + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = groupedTieredPackageConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -22428,9 +24123,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. @@ -22438,6 +24130,19 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) @@ -22446,14 +24151,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. @@ -22462,17 +24159,12 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_tiered_package_config") - fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = groupedTieredPackageConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -22487,60 +24179,64 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedTieredPackageConfig: GroupedTieredPackageConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedTieredPackageConfig: GroupedTieredPackageConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice ) = apply { - metadata = newFloatingGroupedTieredPackagePrice.metadata - externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId + cadence = newFloatingGroupedTieredPackagePrice.cadence + currency = newFloatingGroupedTieredPackagePrice.currency + groupedTieredPackageConfig = + newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig + itemId = newFloatingGroupedTieredPackagePrice.itemId + modelType = newFloatingGroupedTieredPackagePrice.modelType name = newFloatingGroupedTieredPackagePrice.name billableMetricId = newFloatingGroupedTieredPackagePrice.billableMetricId - itemId = newFloatingGroupedTieredPackagePrice.itemId billedInAdvance = newFloatingGroupedTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPackagePrice.invoiceGroupingKey - cadence = newFloatingGroupedTieredPackagePrice.cadence billingCycleConfiguration = newFloatingGroupedTieredPackagePrice.billingCycleConfiguration + conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate + externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedTieredPackagePrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedTieredPackagePrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate - modelType = newFloatingGroupedTieredPackagePrice.modelType - groupedTieredPackageConfig = - newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig - currency = newFloatingGroupedTieredPackagePrice.currency + metadata = newFloatingGroupedTieredPackagePrice.metadata additionalProperties = newFloatingGroupedTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + apply { + this.groupedTieredPackageConfig = groupedTieredPackageConfig + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -22548,66 +24244,134 @@ constructor( /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = - apply { - this.billingCycleConfiguration = billingCycleConfiguration - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = - apply { - this.groupedTieredPackageConfig = groupedTieredPackageConfig - } + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22630,23 +24394,23 @@ constructor( fun build(): NewFloatingGroupedTieredPackagePrice = NewFloatingGroupedTieredPackagePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedTieredPackageConfig) { + "`groupedTieredPackageConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedTieredPackageConfig) { - "`groupedTieredPackageConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -23250,17 +25014,17 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedTieredPackageConfig == other.groupedTieredPackageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedTieredPackagePrice && cadence == other.cadence && currency == other.currency && groupedTieredPackageConfig == other.groupedTieredPackageConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredPackageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredPackageConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredPackageConfig=$groupedTieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedTieredPackagePrice{cadence=$cadence, currency=$currency, groupedTieredPackageConfig=$groupedTieredPackageConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt index b9c3bd0c..85f0b877 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt @@ -157,29 +157,51 @@ constructor( } /** The ID of the customer to which this evaluation is scoped. */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + /** The ID of the customer to which this evaluation is scoped. */ + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** The external customer ID of the customer to which this evaluation is scoped. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + /** The external customer ID of the customer to which this evaluation is scoped. */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + /** + * A boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties) + * used to filter the underlying billable metric + */ + fun filter(filter: String?) = apply { this.filter = filter } + /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) * used to filter the underlying billable metric */ - fun filter(filter: String) = apply { this.filter = filter } + fun filter(filter: Optional) = filter(filter.orElse(null)) /** * Properties (or * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) * used to group the underlying billable metric */ - fun groupingKeys(groupingKeys: List) = apply { - this.groupingKeys = groupingKeys.toMutableList() + fun groupingKeys(groupingKeys: List?) = apply { + this.groupingKeys = groupingKeys?.toMutableList() } + /** + * Properties (or + * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) + * used to group the underlying billable metric + */ + fun groupingKeys(groupingKeys: Optional>) = + groupingKeys(groupingKeys.orElse(null)) + /** * Properties (or * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) @@ -272,26 +294,48 @@ constructor( } /** The ID of the customer to which this evaluation is scoped. */ - fun customerId(customerId: String) = apply { body.customerId(customerId) } + fun customerId(customerId: String?) = apply { body.customerId(customerId) } + + /** The ID of the customer to which this evaluation is scoped. */ + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** The external customer ID of the customer to which this evaluation is scoped. */ - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } + /** The external customer ID of the customer to which this evaluation is scoped. */ + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + /** + * A boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to + * filter the underlying billable metric + */ + fun filter(filter: String?) = apply { body.filter(filter) } + /** * A boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to * filter the underlying billable metric */ - fun filter(filter: String) = apply { body.filter(filter) } + fun filter(filter: Optional) = filter(filter.orElse(null)) + + /** + * Properties (or + * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) used + * to group the underlying billable metric + */ + fun groupingKeys(groupingKeys: List?) = apply { body.groupingKeys(groupingKeys) } /** * Properties (or * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) used * to group the underlying billable metric */ - fun groupingKeys(groupingKeys: List) = apply { body.groupingKeys(groupingKeys) } + fun groupingKeys(groupingKeys: Optional>) = + groupingKeys(groupingKeys.orElse(null)) /** * Properties (or diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt index 25a1dd2b..6544f8b4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt @@ -97,7 +97,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -175,7 +182,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt index 9429ae7d..c6492f28 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt @@ -67,10 +67,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/PriceUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt index db5afcfa..1ed43b2b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt @@ -95,7 +95,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -168,7 +175,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt index 6220af2a..9a6688ed 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt @@ -52,90 +52,131 @@ import kotlin.jvm.optionals.getOrNull class Subscription @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -158,116 +199,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -290,65 +331,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -357,39 +372,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -399,31 +399,31 @@ private constructor( fun validate(): Subscription = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -437,82 +437,167 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscription: Subscription) = apply { - metadata = subscription.metadata id = subscription.id - customer = subscription.customer - plan = subscription.plan - startDate = subscription.startDate - endDate = subscription.endDate - createdAt = subscription.createdAt - currentBillingPeriodStartDate = subscription.currentBillingPeriodStartDate - currentBillingPeriodEndDate = subscription.currentBillingPeriodEndDate - status = subscription.status - trialInfo = subscription.trialInfo activePlanPhaseOrder = subscription.activePlanPhaseOrder - fixedFeeQuantitySchedule = subscription.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscription.defaultInvoiceMemo + adjustmentIntervals = subscription.adjustmentIntervals autoCollection = subscription.autoCollection - netTerms = subscription.netTerms - redeemedCoupon = subscription.redeemedCoupon - billingCycleDay = subscription.billingCycleDay billingCycleAnchorConfiguration = subscription.billingCycleAnchorConfiguration - invoicingThreshold = subscription.invoicingThreshold - priceIntervals = subscription.priceIntervals - adjustmentIntervals = subscription.adjustmentIntervals + billingCycleDay = subscription.billingCycleDay + createdAt = subscription.createdAt + currentBillingPeriodEndDate = subscription.currentBillingPeriodEndDate + currentBillingPeriodStartDate = subscription.currentBillingPeriodStartDate + customer = subscription.customer + defaultInvoiceMemo = subscription.defaultInvoiceMemo discountIntervals = subscription.discountIntervals - minimumIntervals = subscription.minimumIntervals + endDate = subscription.endDate + fixedFeeQuantitySchedule = subscription.fixedFeeQuantitySchedule + invoicingThreshold = subscription.invoicingThreshold maximumIntervals = subscription.maximumIntervals + metadata = subscription.metadata + minimumIntervals = subscription.minimumIntervals + netTerms = subscription.netTerms + plan = subscription.plan + priceIntervals = subscription.priceIntervals + redeemedCoupon = subscription.redeemedCoupon + startDate = subscription.startDate + status = subscription.status + trialInfo = subscription.trialInfo additionalProperties = subscription.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -549,94 +634,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -645,35 +676,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -690,45 +729,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -739,41 +754,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -796,31 +796,31 @@ private constructor( fun build(): Subscription = Subscription( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -833,15 +833,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -850,32 +850,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -886,9 +886,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -904,18 +904,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -929,20 +929,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -953,6 +939,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -976,9 +976,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1232,30 +1232,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1266,22 +1278,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1296,26 +1313,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1325,12 +1325,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1345,23 +1345,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1370,6 +1370,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1394,43 +1425,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1456,12 +1456,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1523,17 +1523,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1543,48 +1543,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1593,32 +1586,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1628,6 +1620,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1637,12 +1637,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1657,24 +1657,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1683,28 +1683,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1716,17 +1699,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1744,6 +1729,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1769,12 +1769,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1836,17 +1836,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1856,21 +1856,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1880,6 +1880,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1890,15 +1896,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1907,6 +1907,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1920,18 +1929,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1947,11 +1947,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1967,22 +1967,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1992,6 +1992,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2016,28 +2032,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2078,11 +2078,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2145,17 +2145,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2165,51 +2165,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2217,35 +2213,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2253,8 +2248,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2265,13 +2265,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2286,25 +2286,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2312,6 +2312,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2327,36 +2343,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2373,11 +2364,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2404,13 +2404,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2472,17 +2472,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2492,56 +2492,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2551,29 +2560,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2583,12 +2583,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2603,23 +2603,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2627,28 +2627,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2660,17 +2643,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2688,6 +2673,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2713,12 +2713,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2780,17 +2780,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2799,17 +2799,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3174,40 +3174,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3216,16 +3207,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3237,6 +3229,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3245,12 +3245,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3264,33 +3264,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3300,20 +3293,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3333,6 +3312,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3357,12 +3357,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3423,57 +3423,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3482,18 +3470,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3505,6 +3492,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3513,12 +3513,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3532,52 +3532,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3586,24 +3584,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3629,12 +3629,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3695,60 +3695,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3757,19 +3742,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3781,6 +3767,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3789,12 +3789,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3808,25 +3808,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3834,6 +3853,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3849,39 +3882,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3906,12 +3906,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3972,17 +3972,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3990,39 +3990,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4031,10 +4031,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4048,39 +4048,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4102,10 +4102,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4115,49 +4115,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4166,6 +4159,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4173,10 +4170,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4188,12 +4182,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4202,11 +4202,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4220,37 +4220,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4270,6 +4256,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4284,6 +4276,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4305,11 +4305,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4319,17 +4319,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4416,32 +4416,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4450,6 +4443,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4457,10 +4454,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4472,12 +4466,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4486,11 +4486,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4504,37 +4504,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4554,6 +4540,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4568,6 +4560,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4589,11 +4589,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4603,17 +4603,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4625,39 +4625,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4666,6 +4683,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4896,51 +4922,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5172,34 +5195,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5210,13 +5210,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5231,26 +5231,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5258,19 +5258,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5284,6 +5313,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5744,64 +5789,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5825,13 +5825,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5840,12 +5840,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5853,16 +5853,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5873,8 +5873,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5889,24 +5889,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5914,6 +5910,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5942,8 +5942,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5954,17 +5954,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5972,17 +5972,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5992,29 +5992,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6024,8 +6024,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6040,15 +6040,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6056,16 +6056,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6088,8 +6088,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6099,17 +6099,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6271,15 +6271,15 @@ private constructor( return true } - return /* spotless:off */ other is Subscription && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Subscription && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Subscription{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "Subscription{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt index 375ec935..3fd4cb69 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt @@ -111,10 +111,17 @@ constructor( * The date that the cancellation should take effect. This parameter can only be passed * if the `cancel_option` is `requested_date`. */ - fun cancellationDate(cancellationDate: OffsetDateTime) = apply { + fun cancellationDate(cancellationDate: OffsetDateTime?) = apply { this.cancellationDate = cancellationDate } + /** + * The date that the cancellation should take effect. This parameter can only be passed + * if the `cancel_option` is `requested_date`. + */ + fun cancellationDate(cancellationDate: Optional) = + cancellationDate(cancellationDate.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -192,10 +199,17 @@ constructor( * The date that the cancellation should take effect. This parameter can only be passed if * the `cancel_option` is `requested_date`. */ - fun cancellationDate(cancellationDate: OffsetDateTime) = apply { + fun cancellationDate(cancellationDate: OffsetDateTime?) = apply { body.cancellationDate(cancellationDate) } + /** + * The date that the cancellation should take effect. This parameter can only be passed if + * the `cancel_option` is `requested_date`. + */ + fun cancellationDate(cancellationDate: Optional) = + cancellationDate(cancellationDate.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt index 8c914552..6ce3c360 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionCancelResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionCancelResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,83 +419,168 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionCancelResponse: SubscriptionCancelResponse) = apply { - metadata = subscriptionCancelResponse.metadata id = subscriptionCancelResponse.id - customer = subscriptionCancelResponse.customer - plan = subscriptionCancelResponse.plan - startDate = subscriptionCancelResponse.startDate - endDate = subscriptionCancelResponse.endDate - createdAt = subscriptionCancelResponse.createdAt - currentBillingPeriodStartDate = subscriptionCancelResponse.currentBillingPeriodStartDate - currentBillingPeriodEndDate = subscriptionCancelResponse.currentBillingPeriodEndDate - status = subscriptionCancelResponse.status - trialInfo = subscriptionCancelResponse.trialInfo activePlanPhaseOrder = subscriptionCancelResponse.activePlanPhaseOrder - fixedFeeQuantitySchedule = subscriptionCancelResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionCancelResponse.defaultInvoiceMemo + adjustmentIntervals = subscriptionCancelResponse.adjustmentIntervals autoCollection = subscriptionCancelResponse.autoCollection - netTerms = subscriptionCancelResponse.netTerms - redeemedCoupon = subscriptionCancelResponse.redeemedCoupon - billingCycleDay = subscriptionCancelResponse.billingCycleDay billingCycleAnchorConfiguration = subscriptionCancelResponse.billingCycleAnchorConfiguration - invoicingThreshold = subscriptionCancelResponse.invoicingThreshold - priceIntervals = subscriptionCancelResponse.priceIntervals - adjustmentIntervals = subscriptionCancelResponse.adjustmentIntervals + billingCycleDay = subscriptionCancelResponse.billingCycleDay + createdAt = subscriptionCancelResponse.createdAt + currentBillingPeriodEndDate = subscriptionCancelResponse.currentBillingPeriodEndDate + currentBillingPeriodStartDate = subscriptionCancelResponse.currentBillingPeriodStartDate + customer = subscriptionCancelResponse.customer + defaultInvoiceMemo = subscriptionCancelResponse.defaultInvoiceMemo discountIntervals = subscriptionCancelResponse.discountIntervals - minimumIntervals = subscriptionCancelResponse.minimumIntervals + endDate = subscriptionCancelResponse.endDate + fixedFeeQuantitySchedule = subscriptionCancelResponse.fixedFeeQuantitySchedule + invoicingThreshold = subscriptionCancelResponse.invoicingThreshold maximumIntervals = subscriptionCancelResponse.maximumIntervals + metadata = subscriptionCancelResponse.metadata + minimumIntervals = subscriptionCancelResponse.minimumIntervals + netTerms = subscriptionCancelResponse.netTerms + plan = subscriptionCancelResponse.plan + priceIntervals = subscriptionCancelResponse.priceIntervals + redeemedCoupon = subscriptionCancelResponse.redeemedCoupon + startDate = subscriptionCancelResponse.startDate + status = subscriptionCancelResponse.status + trialInfo = subscriptionCancelResponse.trialInfo additionalProperties = subscriptionCancelResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -532,94 +617,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -628,35 +659,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -673,45 +712,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -722,41 +737,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -779,31 +779,31 @@ private constructor( fun build(): SubscriptionCancelResponse = SubscriptionCancelResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -816,15 +816,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -833,32 +833,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -869,9 +869,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -887,18 +887,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -912,20 +912,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -936,6 +922,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -959,9 +959,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1215,30 +1215,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1249,22 +1261,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1279,26 +1296,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1308,12 +1308,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1328,23 +1328,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1353,6 +1353,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1377,43 +1408,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1439,12 +1439,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1506,17 +1506,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1526,48 +1526,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1576,32 +1569,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1611,6 +1603,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1620,12 +1620,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1640,24 +1640,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1666,28 +1666,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1699,17 +1682,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1727,6 +1712,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1752,12 +1752,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1819,17 +1819,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1839,21 +1839,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1863,6 +1863,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1873,15 +1879,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1890,6 +1890,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1903,18 +1912,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1930,11 +1930,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1950,22 +1950,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1975,6 +1975,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1999,28 +2015,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2061,11 +2061,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2128,17 +2128,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2148,51 +2148,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2200,35 +2196,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2236,8 +2231,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2248,13 +2248,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2269,25 +2269,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2295,6 +2295,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2310,36 +2326,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2356,11 +2347,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2387,13 +2387,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2455,17 +2455,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2475,56 +2475,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2534,29 +2543,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2566,12 +2566,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2586,23 +2586,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2610,28 +2610,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2643,17 +2626,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2671,6 +2656,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2696,12 +2696,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2763,17 +2763,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2782,17 +2782,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3157,40 +3157,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3199,16 +3190,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3220,6 +3212,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3228,12 +3228,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3247,33 +3247,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3283,20 +3276,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3316,6 +3295,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3340,12 +3340,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3406,57 +3406,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3465,18 +3453,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3488,6 +3475,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3496,12 +3496,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3515,52 +3515,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3569,24 +3567,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3612,12 +3612,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3678,60 +3678,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3740,19 +3725,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3764,6 +3750,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3772,12 +3772,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3791,25 +3791,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3817,6 +3836,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3832,39 +3865,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3889,12 +3889,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3955,17 +3955,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3973,39 +3973,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4014,10 +4014,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4031,39 +4031,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4085,10 +4085,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4098,49 +4098,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4149,6 +4142,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4156,10 +4153,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4171,12 +4165,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4185,11 +4185,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4203,37 +4203,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4253,6 +4239,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4267,6 +4259,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4288,11 +4288,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4302,17 +4302,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4399,32 +4399,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4433,6 +4426,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4440,10 +4437,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4455,12 +4449,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4469,11 +4469,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4487,37 +4487,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4537,6 +4523,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4551,6 +4543,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4572,11 +4572,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4586,17 +4586,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4608,39 +4608,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4649,6 +4666,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4879,51 +4905,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5155,34 +5178,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5193,13 +5193,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5214,26 +5214,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5241,19 +5241,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5267,6 +5296,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5727,64 +5772,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5808,13 +5808,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5823,12 +5823,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5836,16 +5836,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5856,8 +5856,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5872,24 +5872,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5897,6 +5893,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5925,8 +5925,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5937,17 +5937,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5955,17 +5955,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5975,29 +5975,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6007,8 +6007,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6023,15 +6023,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6039,16 +6039,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6071,8 +6071,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6082,17 +6082,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6254,15 +6254,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionCancelResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionCancelResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionCancelResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionCancelResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt index 2f43db11..0843d159 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt @@ -486,10 +486,17 @@ constructor( * Additional adjustments to be added to the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) */ - fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments = addAdjustments.toMutableList() + fun addAdjustments(addAdjustments: List?) = apply { + this.addAdjustments = addAdjustments?.toMutableList() } + /** + * Additional adjustments to be added to the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun addAdjustments(addAdjustments: Optional>) = + addAdjustments(addAdjustments.orElse(null)) + /** * Additional adjustments to be added to the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) @@ -502,10 +509,16 @@ constructor( * Additional prices to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { - this.addPrices = addPrices.toMutableList() + fun addPrices(addPrices: List?) = apply { + this.addPrices = addPrices?.toMutableList() } + /** + * Additional prices to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addPrices(addPrices: Optional>) = addPrices(addPrices.orElse(null)) + /** * Additional prices to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -515,130 +528,288 @@ constructor( } fun alignBillingWithSubscriptionStartDate( - alignBillingWithSubscriptionStartDate: Boolean + alignBillingWithSubscriptionStartDate: Boolean? ) = apply { this.alignBillingWithSubscriptionStartDate = alignBillingWithSubscriptionStartDate } + fun alignBillingWithSubscriptionStartDate( + alignBillingWithSubscriptionStartDate: Boolean + ) = + alignBillingWithSubscriptionStartDate( + alignBillingWithSubscriptionStartDate as Boolean? + ) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun alignBillingWithSubscriptionStartDate( + alignBillingWithSubscriptionStartDate: Optional + ) = + alignBillingWithSubscriptionStartDate( + alignBillingWithSubscriptionStartDate.orElse(null) as Boolean? + ) + /** * Determines whether issued invoices for this subscription will automatically be * charged with the saved payment method on the due date. If not specified, this * defaults to the behavior configured for this customer. */ - fun autoCollection(autoCollection: Boolean) = apply { + fun autoCollection(autoCollection: Boolean?) = apply { this.autoCollection = autoCollection } - fun awsRegion(awsRegion: String) = apply { this.awsRegion = awsRegion } + /** + * Determines whether issued invoices for this subscription will automatically be + * charged with the saved payment method on the due date. If not specified, this + * defaults to the behavior configured for this customer. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Determines whether issued invoices for this subscription will automatically be + * charged with the saved payment method on the due date. If not specified, this + * defaults to the behavior configured for this customer. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) + + fun awsRegion(awsRegion: String?) = apply { this.awsRegion = awsRegion } + + fun awsRegion(awsRegion: Optional) = awsRegion(awsRegion.orElse(null)) fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration? ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: Optional + ) = billingCycleAnchorConfiguration(billingCycleAnchorConfiguration.orElse(null)) + /** * Redemption code to be used for this subscription. If the coupon cannot be found by * its redemption code, or cannot be redeemed, an error response will be returned and * the subscription creation or plan change will not be scheduled. */ - fun couponRedemptionCode(couponRedemptionCode: String) = apply { + fun couponRedemptionCode(couponRedemptionCode: String?) = apply { this.couponRedemptionCode = couponRedemptionCode } - fun creditsOverageRate(creditsOverageRate: Double) = apply { + /** + * Redemption code to be used for this subscription. If the coupon cannot be found by + * its redemption code, or cannot be redeemed, an error response will be returned and + * the subscription creation or plan change will not be scheduled. + */ + fun couponRedemptionCode(couponRedemptionCode: Optional) = + couponRedemptionCode(couponRedemptionCode.orElse(null)) + + fun creditsOverageRate(creditsOverageRate: Double?) = apply { this.creditsOverageRate = creditsOverageRate } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun creditsOverageRate(creditsOverageRate: Double) = + creditsOverageRate(creditsOverageRate as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun creditsOverageRate(creditsOverageRate: Optional) = + creditsOverageRate(creditsOverageRate.orElse(null) as Double?) + + fun customerId(customerId: String?) = apply { this.customerId = customerId } + + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { this.defaultInvoiceMemo = defaultInvoiceMemo } - fun endDate(endDate: OffsetDateTime) = apply { this.endDate = endDate } + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + + fun endDate(endDate: OffsetDateTime?) = apply { this.endDate = endDate } - fun externalCustomerId(externalCustomerId: String) = apply { + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } - fun externalMarketplace(externalMarketplace: ExternalMarketplace) = apply { + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + fun externalMarketplace(externalMarketplace: ExternalMarketplace?) = apply { this.externalMarketplace = externalMarketplace } - fun externalMarketplaceReportingId(externalMarketplaceReportingId: String) = apply { + fun externalMarketplace(externalMarketplace: Optional) = + externalMarketplace(externalMarketplace.orElse(null)) + + fun externalMarketplaceReportingId(externalMarketplaceReportingId: String?) = apply { this.externalMarketplaceReportingId = externalMarketplaceReportingId } + fun externalMarketplaceReportingId(externalMarketplaceReportingId: Optional) = + externalMarketplaceReportingId(externalMarketplaceReportingId.orElse(null)) + /** * The external_plan_id of the plan that the given subscription should be switched to. * Note that either this property or `plan_id` must be specified. */ - fun externalPlanId(externalPlanId: String) = apply { + fun externalPlanId(externalPlanId: String?) = apply { this.externalPlanId = externalPlanId } + /** + * The external_plan_id of the plan that the given subscription should be switched to. + * Note that either this property or `plan_id` must be specified. + */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + /** * An additional filter to apply to usage queries. This filter must be expressed as a * boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If * null, usage queries will not include any additional filter. */ - fun filter(filter: String) = apply { this.filter = filter } + fun filter(filter: String?) = apply { this.filter = filter } + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: Optional) = filter(filter.orElse(null)) /** The phase of the plan to start with */ - fun initialPhaseOrder(initialPhaseOrder: Long) = apply { + fun initialPhaseOrder(initialPhaseOrder: Long?) = apply { this.initialPhaseOrder = initialPhaseOrder } + /** The phase of the plan to start with */ + fun initialPhaseOrder(initialPhaseOrder: Long) = + initialPhaseOrder(initialPhaseOrder as Long?) + + /** The phase of the plan to start with */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun initialPhaseOrder(initialPhaseOrder: Optional) = + initialPhaseOrder(initialPhaseOrder.orElse(null) as Long?) + /** * When this subscription's accrued usage reaches this threshold, an invoice will be * issued for the subscription. If not specified, invoices will only be issued at the * end of the billing period. */ - fun invoicingThreshold(invoicingThreshold: String) = apply { + fun invoicingThreshold(invoicingThreshold: String?) = apply { this.invoicingThreshold = invoicingThreshold } + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be + * issued for the subscription. If not specified, invoices will only be issued at the + * end of the billing period. + */ + fun invoicingThreshold(invoicingThreshold: Optional) = + invoicingThreshold(invoicingThreshold.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) /** * The net terms determines the difference between the invoice date and the issue date * for the invoice. If you intend the invoice to be due on issue, set this to 0. If not * provided, this defaults to the value specified in the plan. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + fun netTerms(netTerms: Long?) = apply { this.netTerms = netTerms } - fun perCreditOverageAmount(perCreditOverageAmount: Double) = apply { + /** + * The net terms determines the difference between the invoice date and the issue date + * for the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) + + /** + * The net terms determines the difference between the invoice date and the issue date + * for the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.orElse(null) as Long?) + + fun perCreditOverageAmount(perCreditOverageAmount: Double?) = apply { this.perCreditOverageAmount = perCreditOverageAmount } + fun perCreditOverageAmount(perCreditOverageAmount: Double) = + perCreditOverageAmount(perCreditOverageAmount as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perCreditOverageAmount(perCreditOverageAmount: Optional) = + perCreditOverageAmount(perCreditOverageAmount.orElse(null) as Double?) + /** * The plan that the given subscription should be switched to. Note that either this * property or `external_plan_id` must be specified. */ - fun planId(planId: String) = apply { this.planId = planId } + fun planId(planId: String?) = apply { this.planId = planId } + + /** + * The plan that the given subscription should be switched to. Note that either this + * property or `external_plan_id` must be specified. + */ + fun planId(planId: Optional) = planId(planId.orElse(null)) /** * Specifies which version of the plan to subscribe to. If null, the default version * will be used. */ - fun planVersionNumber(planVersionNumber: Long) = apply { + fun planVersionNumber(planVersionNumber: Long?) = apply { this.planVersionNumber = planVersionNumber } + /** + * Specifies which version of the plan to subscribe to. If null, the default version + * will be used. + */ + fun planVersionNumber(planVersionNumber: Long) = + planVersionNumber(planVersionNumber as Long?) + + /** + * Specifies which version of the plan to subscribe to. If null, the default version + * will be used. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planVersionNumber(planVersionNumber: Optional) = + planVersionNumber(planVersionNumber.orElse(null) as Long?) + /** Optionally provide a list of overrides for prices on the plan */ - fun priceOverrides(priceOverrides: List) = apply { - this.priceOverrides = priceOverrides.toMutableList() + fun priceOverrides(priceOverrides: List?) = apply { + this.priceOverrides = priceOverrides?.toMutableList() } + /** Optionally provide a list of overrides for prices on the plan */ + fun priceOverrides(priceOverrides: Optional>) = + priceOverrides(priceOverrides.orElse(null)) + /** Optionally provide a list of overrides for prices on the plan */ fun addPriceOverride(priceOverride: JsonValue) = apply { priceOverrides = (priceOverrides ?: mutableListOf()).apply { add(priceOverride) } @@ -648,10 +819,17 @@ constructor( * Plan adjustments to be removed from the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) */ - fun removeAdjustments(removeAdjustments: List) = apply { - this.removeAdjustments = removeAdjustments.toMutableList() + fun removeAdjustments(removeAdjustments: List?) = apply { + this.removeAdjustments = removeAdjustments?.toMutableList() } + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun removeAdjustments(removeAdjustments: Optional>) = + removeAdjustments(removeAdjustments.orElse(null)) + /** * Plan adjustments to be removed from the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) @@ -665,10 +843,17 @@ constructor( * Plan prices to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun removePrices(removePrices: List) = apply { - this.removePrices = removePrices.toMutableList() + fun removePrices(removePrices: List?) = apply { + this.removePrices = removePrices?.toMutableList() } + /** + * Plan prices to be removed from the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun removePrices(removePrices: Optional>) = + removePrices(removePrices.orElse(null)) + /** * Plan prices to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -681,10 +866,17 @@ constructor( * Plan adjustments to be replaced with additional adjustments on the subscription. * (Only available for accounts that have migrated off of legacy subscription overrides) */ - fun replaceAdjustments(replaceAdjustments: List) = apply { - this.replaceAdjustments = replaceAdjustments.toMutableList() + fun replaceAdjustments(replaceAdjustments: List?) = apply { + this.replaceAdjustments = replaceAdjustments?.toMutableList() } + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. + * (Only available for accounts that have migrated off of legacy subscription overrides) + */ + fun replaceAdjustments(replaceAdjustments: Optional>) = + replaceAdjustments(replaceAdjustments.orElse(null)) + /** * Plan adjustments to be replaced with additional adjustments on the subscription. * (Only available for accounts that have migrated off of legacy subscription overrides) @@ -698,10 +890,17 @@ constructor( * Plan prices to be replaced with additional prices on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) */ - fun replacePrices(replacePrices: List) = apply { - this.replacePrices = replacePrices.toMutableList() + fun replacePrices(replacePrices: List?) = apply { + this.replacePrices = replacePrices?.toMutableList() } + /** + * Plan prices to be replaced with additional prices on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun replacePrices(replacePrices: Optional>) = + replacePrices(replacePrices.orElse(null)) + /** * Plan prices to be replaced with additional prices on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) @@ -710,16 +909,33 @@ constructor( replacePrices = (replacePrices ?: mutableListOf()).apply { add(replacePrice) } } - fun startDate(startDate: OffsetDateTime) = apply { this.startDate = startDate } + fun startDate(startDate: OffsetDateTime?) = apply { this.startDate = startDate } + + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) /** * The duration of the trial period in days. If not provided, this defaults to the value * specified in the plan. If `0` is provided, the trial on the plan will be skipped. */ - fun trialDurationDays(trialDurationDays: Long) = apply { + fun trialDurationDays(trialDurationDays: Long?) = apply { this.trialDurationDays = trialDurationDays } + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + fun trialDurationDays(trialDurationDays: Long) = + trialDurationDays(trialDurationDays as Long?) + + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun trialDurationDays(trialDurationDays: Optional) = + trialDurationDays(trialDurationDays.orElse(null) as Long?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -818,10 +1034,17 @@ constructor( * Additional adjustments to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun addAdjustments(addAdjustments: List) = apply { + fun addAdjustments(addAdjustments: List?) = apply { body.addAdjustments(addAdjustments) } + /** + * Additional adjustments to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addAdjustments(addAdjustments: Optional>) = + addAdjustments(addAdjustments.orElse(null)) + /** * Additional adjustments to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -834,7 +1057,13 @@ constructor( * Additional prices to be added to the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { body.addPrices(addPrices) } + fun addPrices(addPrices: List?) = apply { body.addPrices(addPrices) } + + /** + * Additional prices to be added to the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun addPrices(addPrices: Optional>) = addPrices(addPrices.orElse(null)) /** * Additional prices to be added to the subscription. (Only available for accounts that have @@ -842,66 +1071,141 @@ constructor( */ fun addAddPrice(addPrice: AddPrice) = apply { body.addAddPrice(addPrice) } - fun alignBillingWithSubscriptionStartDate(alignBillingWithSubscriptionStartDate: Boolean) = + fun alignBillingWithSubscriptionStartDate(alignBillingWithSubscriptionStartDate: Boolean?) = apply { body.alignBillingWithSubscriptionStartDate(alignBillingWithSubscriptionStartDate) } + fun alignBillingWithSubscriptionStartDate(alignBillingWithSubscriptionStartDate: Boolean) = + alignBillingWithSubscriptionStartDate(alignBillingWithSubscriptionStartDate as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun alignBillingWithSubscriptionStartDate( + alignBillingWithSubscriptionStartDate: Optional + ) = + alignBillingWithSubscriptionStartDate( + alignBillingWithSubscriptionStartDate.orElse(null) as Boolean? + ) + /** * Determines whether issued invoices for this subscription will automatically be charged * with the saved payment method on the due date. If not specified, this defaults to the * behavior configured for this customer. */ - fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } + fun autoCollection(autoCollection: Boolean?) = apply { body.autoCollection(autoCollection) } - fun awsRegion(awsRegion: String) = apply { body.awsRegion(awsRegion) } + /** + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. If not specified, this defaults to the + * behavior configured for this customer. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. If not specified, this defaults to the + * behavior configured for this customer. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) + + fun awsRegion(awsRegion: String?) = apply { body.awsRegion(awsRegion) } + + fun awsRegion(awsRegion: Optional) = awsRegion(awsRegion.orElse(null)) fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration? ) = apply { body.billingCycleAnchorConfiguration(billingCycleAnchorConfiguration) } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: Optional + ) = billingCycleAnchorConfiguration(billingCycleAnchorConfiguration.orElse(null)) + /** * Redemption code to be used for this subscription. If the coupon cannot be found by its * redemption code, or cannot be redeemed, an error response will be returned and the * subscription creation or plan change will not be scheduled. */ - fun couponRedemptionCode(couponRedemptionCode: String) = apply { + fun couponRedemptionCode(couponRedemptionCode: String?) = apply { body.couponRedemptionCode(couponRedemptionCode) } - fun creditsOverageRate(creditsOverageRate: Double) = apply { + /** + * Redemption code to be used for this subscription. If the coupon cannot be found by its + * redemption code, or cannot be redeemed, an error response will be returned and the + * subscription creation or plan change will not be scheduled. + */ + fun couponRedemptionCode(couponRedemptionCode: Optional) = + couponRedemptionCode(couponRedemptionCode.orElse(null)) + + fun creditsOverageRate(creditsOverageRate: Double?) = apply { body.creditsOverageRate(creditsOverageRate) } - fun customerId(customerId: String) = apply { body.customerId(customerId) } + fun creditsOverageRate(creditsOverageRate: Double) = + creditsOverageRate(creditsOverageRate as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun creditsOverageRate(creditsOverageRate: Optional) = + creditsOverageRate(creditsOverageRate.orElse(null) as Double?) + + fun customerId(customerId: String?) = apply { body.customerId(customerId) } + + fun customerId(customerId: Optional) = customerId(customerId.orElse(null)) /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { body.defaultInvoiceMemo(defaultInvoiceMemo) } - fun endDate(endDate: OffsetDateTime) = apply { body.endDate(endDate) } + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + + fun endDate(endDate: OffsetDateTime?) = apply { body.endDate(endDate) } + + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { body.externalCustomerId(externalCustomerId) } - fun externalMarketplace(externalMarketplace: ExternalMarketplace) = apply { + fun externalCustomerId(externalCustomerId: Optional) = + externalCustomerId(externalCustomerId.orElse(null)) + + fun externalMarketplace(externalMarketplace: ExternalMarketplace?) = apply { body.externalMarketplace(externalMarketplace) } - fun externalMarketplaceReportingId(externalMarketplaceReportingId: String) = apply { + fun externalMarketplace(externalMarketplace: Optional) = + externalMarketplace(externalMarketplace.orElse(null)) + + fun externalMarketplaceReportingId(externalMarketplaceReportingId: String?) = apply { body.externalMarketplaceReportingId(externalMarketplaceReportingId) } + fun externalMarketplaceReportingId(externalMarketplaceReportingId: Optional) = + externalMarketplaceReportingId(externalMarketplaceReportingId.orElse(null)) + /** * The external_plan_id of the plan that the given subscription should be switched to. Note * that either this property or `plan_id` must be specified. */ - fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } + fun externalPlanId(externalPlanId: String?) = apply { body.externalPlanId(externalPlanId) } + + /** + * The external_plan_id of the plan that the given subscription should be switched to. Note + * that either this property or `plan_id` must be specified. + */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) /** * An additional filter to apply to usage queries. This filter must be expressed as a @@ -909,59 +1213,138 @@ constructor( * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If * null, usage queries will not include any additional filter. */ - fun filter(filter: String) = apply { body.filter(filter) } + fun filter(filter: String?) = apply { body.filter(filter) } + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: Optional) = filter(filter.orElse(null)) /** The phase of the plan to start with */ - fun initialPhaseOrder(initialPhaseOrder: Long) = apply { + fun initialPhaseOrder(initialPhaseOrder: Long?) = apply { body.initialPhaseOrder(initialPhaseOrder) } + /** The phase of the plan to start with */ + fun initialPhaseOrder(initialPhaseOrder: Long) = + initialPhaseOrder(initialPhaseOrder as Long?) + + /** The phase of the plan to start with */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun initialPhaseOrder(initialPhaseOrder: Optional) = + initialPhaseOrder(initialPhaseOrder.orElse(null) as Long?) + /** * When this subscription's accrued usage reaches this threshold, an invoice will be issued * for the subscription. If not specified, invoices will only be issued at the end of the * billing period. */ - fun invoicingThreshold(invoicingThreshold: String) = apply { + fun invoicingThreshold(invoicingThreshold: String?) = apply { body.invoicingThreshold(invoicingThreshold) } + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be issued + * for the subscription. If not specified, invoices will only be issued at the end of the + * billing period. + */ + fun invoicingThreshold(invoicingThreshold: Optional) = + invoicingThreshold(invoicingThreshold.orElse(null)) + /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** + * The net terms determines the difference between the invoice date and the issue date for + * the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + fun netTerms(netTerms: Long?) = apply { body.netTerms(netTerms) } /** * The net terms determines the difference between the invoice date and the issue date for * the invoice. If you intend the invoice to be due on issue, set this to 0. If not * provided, this defaults to the value specified in the plan. */ - fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) - fun perCreditOverageAmount(perCreditOverageAmount: Double) = apply { + /** + * The net terms determines the difference between the invoice date and the issue date for + * the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.orElse(null) as Long?) + + fun perCreditOverageAmount(perCreditOverageAmount: Double?) = apply { body.perCreditOverageAmount(perCreditOverageAmount) } + fun perCreditOverageAmount(perCreditOverageAmount: Double) = + perCreditOverageAmount(perCreditOverageAmount as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perCreditOverageAmount(perCreditOverageAmount: Optional) = + perCreditOverageAmount(perCreditOverageAmount.orElse(null) as Double?) + /** * The plan that the given subscription should be switched to. Note that either this * property or `external_plan_id` must be specified. */ - fun planId(planId: String) = apply { body.planId(planId) } + fun planId(planId: String?) = apply { body.planId(planId) } + + /** + * The plan that the given subscription should be switched to. Note that either this + * property or `external_plan_id` must be specified. + */ + fun planId(planId: Optional) = planId(planId.orElse(null)) /** * Specifies which version of the plan to subscribe to. If null, the default version will be * used. */ - fun planVersionNumber(planVersionNumber: Long) = apply { + fun planVersionNumber(planVersionNumber: Long?) = apply { body.planVersionNumber(planVersionNumber) } + /** + * Specifies which version of the plan to subscribe to. If null, the default version will be + * used. + */ + fun planVersionNumber(planVersionNumber: Long) = + planVersionNumber(planVersionNumber as Long?) + + /** + * Specifies which version of the plan to subscribe to. If null, the default version will be + * used. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planVersionNumber(planVersionNumber: Optional) = + planVersionNumber(planVersionNumber.orElse(null) as Long?) + /** Optionally provide a list of overrides for prices on the plan */ - fun priceOverrides(priceOverrides: List) = apply { + fun priceOverrides(priceOverrides: List?) = apply { body.priceOverrides(priceOverrides) } + /** Optionally provide a list of overrides for prices on the plan */ + fun priceOverrides(priceOverrides: Optional>) = + priceOverrides(priceOverrides.orElse(null)) + /** Optionally provide a list of overrides for prices on the plan */ fun addPriceOverride(priceOverride: JsonValue) = apply { body.addPriceOverride(priceOverride) @@ -971,10 +1354,17 @@ constructor( * Plan adjustments to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun removeAdjustments(removeAdjustments: List) = apply { + fun removeAdjustments(removeAdjustments: List?) = apply { body.removeAdjustments(removeAdjustments) } + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun removeAdjustments(removeAdjustments: Optional>) = + removeAdjustments(removeAdjustments.orElse(null)) + /** * Plan adjustments to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -987,10 +1377,17 @@ constructor( * Plan prices to be removed from the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun removePrices(removePrices: List) = apply { + fun removePrices(removePrices: List?) = apply { body.removePrices(removePrices) } + /** + * Plan prices to be removed from the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun removePrices(removePrices: Optional>) = + removePrices(removePrices.orElse(null)) + /** * Plan prices to be removed from the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) @@ -1001,10 +1398,17 @@ constructor( * Plan adjustments to be replaced with additional adjustments on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) */ - fun replaceAdjustments(replaceAdjustments: List) = apply { + fun replaceAdjustments(replaceAdjustments: List?) = apply { body.replaceAdjustments(replaceAdjustments) } + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun replaceAdjustments(replaceAdjustments: Optional>) = + replaceAdjustments(replaceAdjustments.orElse(null)) + /** * Plan adjustments to be replaced with additional adjustments on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) @@ -1017,10 +1421,17 @@ constructor( * Plan prices to be replaced with additional prices on the subscription. (Only available * for accounts that have migrated off of legacy subscription overrides) */ - fun replacePrices(replacePrices: List) = apply { + fun replacePrices(replacePrices: List?) = apply { body.replacePrices(replacePrices) } + /** + * Plan prices to be replaced with additional prices on the subscription. (Only available + * for accounts that have migrated off of legacy subscription overrides) + */ + fun replacePrices(replacePrices: Optional>) = + replacePrices(replacePrices.orElse(null)) + /** * Plan prices to be replaced with additional prices on the subscription. (Only available * for accounts that have migrated off of legacy subscription overrides) @@ -1029,16 +1440,33 @@ constructor( body.addReplacePrice(replacePrice) } - fun startDate(startDate: OffsetDateTime) = apply { body.startDate(startDate) } + fun startDate(startDate: OffsetDateTime?) = apply { body.startDate(startDate) } + + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) /** * The duration of the trial period in days. If not provided, this defaults to the value * specified in the plan. If `0` is provided, the trial on the plan will be skipped. */ - fun trialDurationDays(trialDurationDays: Long) = apply { + fun trialDurationDays(trialDurationDays: Long?) = apply { body.trialDurationDays(trialDurationDays) } + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + fun trialDurationDays(trialDurationDays: Long) = + trialDurationDays(trialDurationDays as Long?) + + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun trialDurationDays(trialDurationDays: Optional) = + trialDurationDays(trialDurationDays.orElse(null) as Long?) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -1169,9 +1597,9 @@ constructor( @JsonCreator private constructor( @JsonProperty("adjustment") private val adjustment: Adjustment, - @JsonProperty("start_date") private val startDate: OffsetDateTime?, @JsonProperty("end_date") private val endDate: OffsetDateTime?, @JsonProperty("plan_phase_order") private val planPhaseOrder: Long?, + @JsonProperty("start_date") private val startDate: OffsetDateTime?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -1179,14 +1607,6 @@ constructor( /** The definition of a new adjustment to create and add to the subscription. */ @JsonProperty("adjustment") fun adjustment(): Adjustment = adjustment - /** - * The start date of the adjustment interval. This is the date that the adjustment will - * start affecting prices on the subscription. If null, the adjustment will start when the - * phase or subscription starts. - */ - @JsonProperty("start_date") - fun startDate(): Optional = Optional.ofNullable(startDate) - /** * The end date of the adjustment interval. This is the date that the adjustment will stop * affecting prices on the subscription. If null, the adjustment will start when the phase @@ -1199,6 +1619,14 @@ constructor( @JsonProperty("plan_phase_order") fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder) + /** + * The start date of the adjustment interval. This is the date that the adjustment will + * start affecting prices on the subscription. If null, the adjustment will start when the + * phase or subscription starts. + */ + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1213,17 +1641,17 @@ constructor( class Builder { private var adjustment: Adjustment? = null - private var startDate: OffsetDateTime? = null private var endDate: OffsetDateTime? = null private var planPhaseOrder: Long? = null + private var startDate: OffsetDateTime? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(addAdjustment: AddAdjustment) = apply { adjustment = addAdjustment.adjustment - startDate = addAdjustment.startDate endDate = addAdjustment.endDate planPhaseOrder = addAdjustment.planPhaseOrder + startDate = addAdjustment.startDate additionalProperties = addAdjustment.additionalProperties.toMutableMap() } @@ -1251,24 +1679,46 @@ constructor( } /** - * The start date of the adjustment interval. This is the date that the adjustment will - * start affecting prices on the subscription. If null, the adjustment will start when + * The end date of the adjustment interval. This is the date that the adjustment will + * stop affecting prices on the subscription. If null, the adjustment will start when * the phase or subscription starts. */ - fun startDate(startDate: OffsetDateTime) = apply { this.startDate = startDate } + fun endDate(endDate: OffsetDateTime?) = apply { this.endDate = endDate } /** * The end date of the adjustment interval. This is the date that the adjustment will * stop affecting prices on the subscription. If null, the adjustment will start when * the phase or subscription starts. */ - fun endDate(endDate: OffsetDateTime) = apply { this.endDate = endDate } + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) /** The phase to add this adjustment to. */ - fun planPhaseOrder(planPhaseOrder: Long) = apply { + fun planPhaseOrder(planPhaseOrder: Long?) = apply { this.planPhaseOrder = planPhaseOrder } + /** The phase to add this adjustment to. */ + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(planPhaseOrder as Long?) + + /** The phase to add this adjustment to. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planPhaseOrder(planPhaseOrder: Optional) = + planPhaseOrder(planPhaseOrder.orElse(null) as Long?) + + /** + * The start date of the adjustment interval. This is the date that the adjustment will + * start affecting prices on the subscription. If null, the adjustment will start when + * the phase or subscription starts. + */ + fun startDate(startDate: OffsetDateTime?) = apply { this.startDate = startDate } + + /** + * The start date of the adjustment interval. This is the date that the adjustment will + * start affecting prices on the subscription. If null, the adjustment will start when + * the phase or subscription starts. + */ + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1291,9 +1741,9 @@ constructor( fun build(): AddAdjustment = AddAdjustment( checkNotNull(adjustment) { "`adjustment` is required but was not set" }, - startDate, endDate, planPhaseOrder, + startDate, additionalProperties.toImmutable(), ) } @@ -1486,18 +1936,24 @@ constructor( class NewPercentageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("percentage_discount") private val percentageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("percentage_discount") + fun percentageDiscount(): Double = percentageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -1505,12 +1961,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("percentage_discount") - fun percentageDiscount(): Double = percentageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1524,22 +1974,26 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var percentageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel adjustmentType = newPercentageDiscount.adjustmentType + appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() percentageDiscount = newPercentageDiscount.percentageDiscount + isInvoiceLevel = newPercentageDiscount.isInvoiceLevel additionalProperties = newPercentageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -1551,21 +2005,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun percentageDiscount(percentageDiscount: Double) = apply { + this.percentageDiscount = percentageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun percentageDiscount(percentageDiscount: Double) = apply { - this.percentageDiscount = percentageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1591,17 +2056,17 @@ constructor( fun build(): NewPercentageDiscount = NewPercentageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(percentageDiscount) { "`percentageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -1663,35 +2128,40 @@ constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, percentageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewUsageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("usage_discount") private val usageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -1699,11 +2169,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1717,21 +2182,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var usageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newUsageDiscount.isInvoiceLevel adjustmentType = newUsageDiscount.adjustmentType + appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() usageDiscount = newUsageDiscount.usageDiscount + isInvoiceLevel = newUsageDiscount.isInvoiceLevel additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -1743,21 +2212,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun usageDiscount(usageDiscount: Double) = apply { + this.usageDiscount = usageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun usageDiscount(usageDiscount: Double) = apply { - this.usageDiscount = usageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1783,17 +2263,17 @@ constructor( fun build(): NewUsageDiscount = NewUsageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(usageDiscount) { "`usageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -1855,31 +2335,36 @@ constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, usageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewAmountDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, @JsonProperty("amount_discount") private val amountDiscount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + + @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds @@ -1891,11 +2376,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1909,21 +2389,29 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null + private var appliesToPriceIds: MutableList? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newAmountDiscount.isInvoiceLevel adjustmentType = newAmountDiscount.adjustmentType amountDiscount = newAmountDiscount.amountDiscount + appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() + isInvoiceLevel = newAmountDiscount.isInvoiceLevel additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + + fun amountDiscount(amountDiscount: String) = apply { + this.amountDiscount = amountDiscount + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -1939,17 +2427,24 @@ constructor( * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1975,17 +2470,17 @@ constructor( fun build(): NewAmountDiscount = NewAmountDiscount( - checkNotNull(appliesToPriceIds) { - "`appliesToPriceIds` is required but was not set" - } - .toImmutable(), - isInvoiceLevel, checkNotNull(adjustmentType) { "`adjustmentType` is required but was not set" }, checkNotNull(amountDiscount) { "`amountDiscount` is required but was not set" }, + checkNotNull(appliesToPriceIds) { + "`appliesToPriceIds` is required but was not set" + } + .toImmutable(), + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -2047,36 +2542,44 @@ constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMinimum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, - @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("item_id") private val itemId: String, + @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -2084,14 +2587,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount - - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") fun itemId(): String = itemId - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2105,23 +2600,27 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null - private var minimumAmount: String? = null + private var appliesToPriceIds: MutableList? = null private var itemId: String? = null + private var minimumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMinimum: NewMinimum) = apply { - appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMinimum.isInvoiceLevel adjustmentType = newMinimum.adjustmentType - minimumAmount = newMinimum.minimumAmount + appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() itemId = newMinimum.itemId + minimumAmount = newMinimum.minimumAmount + isInvoiceLevel = newMinimum.isInvoiceLevel additionalProperties = newMinimum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -2133,24 +2632,35 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun minimumAmount(minimumAmount: String) = apply { + this.minimumAmount = minimumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } - - fun minimumAmount(minimumAmount: String) = apply { - this.minimumAmount = minimumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2176,18 +2686,18 @@ constructor( fun build(): NewMinimum = NewMinimum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, - checkNotNull(itemId) { "`itemId` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -2249,35 +2759,40 @@ constructor( return true } - return /* spotless:off */ other is NewMinimum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMinimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, itemId, minimumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMaximum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("maximum_amount") private val maximumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -2285,11 +2800,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2303,21 +2813,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var maximumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMaximum: NewMaximum) = apply { - appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMaximum.isInvoiceLevel adjustmentType = newMaximum.adjustmentType + appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() maximumAmount = newMaximum.maximumAmount + isInvoiceLevel = newMaximum.isInvoiceLevel additionalProperties = newMaximum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -2329,21 +2843,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun maximumAmount(maximumAmount: String) = apply { + this.maximumAmount = maximumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun maximumAmount(maximumAmount: String) = apply { - this.maximumAmount = maximumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2369,17 +2894,17 @@ constructor( fun build(): NewMaximum = NewMaximum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(maximumAmount) { "`maximumAmount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -2441,17 +2966,17 @@ constructor( return true } - return /* spotless:off */ other is NewMaximum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, maximumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -2460,52 +2985,41 @@ constructor( return true } - return /* spotless:off */ other is AddAdjustment && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && planPhaseOrder == other.planPhaseOrder && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddAdjustment && adjustment == other.adjustment && endDate == other.endDate && planPhaseOrder == other.planPhaseOrder && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(adjustment, startDate, endDate, planPhaseOrder, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustment, endDate, planPhaseOrder, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddAdjustment{adjustment=$adjustment, startDate=$startDate, endDate=$endDate, planPhaseOrder=$planPhaseOrder, additionalProperties=$additionalProperties}" + "AddAdjustment{adjustment=$adjustment, endDate=$endDate, planPhaseOrder=$planPhaseOrder, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddPrice @JsonCreator private constructor( - @JsonProperty("price_id") private val priceId: String?, + @JsonProperty("discounts") private val discounts: List?, + @JsonProperty("end_date") private val endDate: OffsetDateTime?, @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("maximum_amount") private val maximumAmount: String?, + @JsonProperty("minimum_amount") private val minimumAmount: String?, + @JsonProperty("plan_phase_order") private val planPhaseOrder: Long?, @JsonProperty("price") private val price: Price?, + @JsonProperty("price_id") private val priceId: String?, @JsonProperty("start_date") private val startDate: OffsetDateTime?, - @JsonProperty("end_date") private val endDate: OffsetDateTime?, - @JsonProperty("plan_phase_order") private val planPhaseOrder: Long?, - @JsonProperty("minimum_amount") private val minimumAmount: String?, - @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("discounts") private val discounts: List?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the price to add to the subscription. */ - @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) - - /** The external price id of the price to add to the subscription. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) - - /** The definition of a new price to create and add to the subscription. */ - @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) - /** - * The start date of the price interval. This is the date that the price will start billing - * on the subscription. If null, billing will start when the phase or subscription starts. + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this price. */ - @JsonProperty("start_date") - fun startDate(): Optional = Optional.ofNullable(startDate) + @JsonProperty("discounts") + fun discounts(): Optional> = Optional.ofNullable(discounts) /** * The end date of the price interval. This is the date that the price will stop billing on @@ -2514,29 +3028,40 @@ constructor( @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) - /** The phase to add this price to. */ - @JsonProperty("plan_phase_order") - fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder) + /** The external price id of the price to add to the subscription. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this * price. */ - @JsonProperty("minimum_amount") - fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + @JsonProperty("maximum_amount") + fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this * price. */ - @JsonProperty("maximum_amount") - fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) + @JsonProperty("minimum_amount") + fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + + /** The phase to add this price to. */ + @JsonProperty("plan_phase_order") + fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder) + + /** The definition of a new price to create and add to the subscription. */ + @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) + + /** The id of the price to add to the subscription. */ + @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this price. + * The start date of the price interval. This is the date that the price will start billing + * on the subscription. If null, billing will start when the phase or subscription starts. */ - @JsonProperty("discounts") - fun discounts(): Optional> = Optional.ofNullable(discounts) + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) @JsonAnyGetter @ExcludeMissing @@ -2551,41 +3076,118 @@ constructor( class Builder { - private var priceId: String? = null + private var discounts: MutableList? = null + private var endDate: OffsetDateTime? = null private var externalPriceId: String? = null + private var maximumAmount: String? = null + private var minimumAmount: String? = null + private var planPhaseOrder: Long? = null private var price: Price? = null + private var priceId: String? = null private var startDate: OffsetDateTime? = null - private var endDate: OffsetDateTime? = null - private var planPhaseOrder: Long? = null - private var minimumAmount: String? = null - private var maximumAmount: String? = null - private var discounts: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(addPrice: AddPrice) = apply { - priceId = addPrice.priceId + discounts = addPrice.discounts?.toMutableList() + endDate = addPrice.endDate externalPriceId = addPrice.externalPriceId + maximumAmount = addPrice.maximumAmount + minimumAmount = addPrice.minimumAmount + planPhaseOrder = addPrice.planPhaseOrder price = addPrice.price + priceId = addPrice.priceId startDate = addPrice.startDate - endDate = addPrice.endDate - planPhaseOrder = addPrice.planPhaseOrder - minimumAmount = addPrice.minimumAmount - maximumAmount = addPrice.maximumAmount - discounts = addPrice.discounts?.toMutableList() additionalProperties = addPrice.additionalProperties.toMutableMap() } - /** The id of the price to add to the subscription. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun discounts(discounts: List?) = apply { + this.discounts = discounts?.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun discounts(discounts: Optional>) = discounts(discounts.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } + + /** + * The end date of the price interval. This is the date that the price will stop billing + * on the subscription. If null, billing will end when the phase or subscription ends. + */ + fun endDate(endDate: OffsetDateTime?) = apply { this.endDate = endDate } + + /** + * The end date of the price interval. This is the date that the price will stop billing + * on the subscription. If null, billing will end when the phase or subscription ends. + */ + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) /** The external price id of the price to add to the subscription. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** The external price id of the price to add to the subscription. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this + * price. + */ + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this + * price. + */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this + * price. + */ + fun minimumAmount(minimumAmount: String?) = apply { this.minimumAmount = minimumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this + * price. + */ + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null)) + + /** The phase to add this price to. */ + fun planPhaseOrder(planPhaseOrder: Long?) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The phase to add this price to. */ + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(planPhaseOrder as Long?) + + /** The phase to add this price to. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planPhaseOrder(planPhaseOrder: Optional) = + planPhaseOrder(planPhaseOrder.orElse(null) as Long?) + + /** The definition of a new price to create and add to the subscription. */ + fun price(price: Price?) = apply { this.price = price } + /** The definition of a new price to create and add to the subscription. */ - fun price(price: Price) = apply { this.price = price } + fun price(price: Optional) = price(price.orElse(null)) fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) @@ -2707,51 +3309,25 @@ constructor( ) } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: String?) = apply { this.priceId = priceId } + + /** The id of the price to add to the subscription. */ + fun priceId(priceId: Optional) = priceId(priceId.orElse(null)) + /** * The start date of the price interval. This is the date that the price will start * billing on the subscription. If null, billing will start when the phase or * subscription starts. */ - fun startDate(startDate: OffsetDateTime) = apply { this.startDate = startDate } + fun startDate(startDate: OffsetDateTime?) = apply { this.startDate = startDate } /** - * The end date of the price interval. This is the date that the price will stop billing - * on the subscription. If null, billing will end when the phase or subscription ends. - */ - fun endDate(endDate: OffsetDateTime) = apply { this.endDate = endDate } - - /** The phase to add this price to. */ - fun planPhaseOrder(planPhaseOrder: Long) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this - * price. - */ - fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this - * price. - */ - fun maximumAmount(maximumAmount: String) = apply { this.maximumAmount = maximumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this - * price. - */ - fun discounts(discounts: List) = apply { - this.discounts = discounts.toMutableList() - } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this - * price. + * The start date of the price interval. This is the date that the price will start + * billing on the subscription. If null, billing will start when the phase or + * subscription starts. */ - fun addDiscount(discount: Discount) = apply { - discounts = (discounts ?: mutableListOf()).apply { add(discount) } - } + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2774,15 +3350,15 @@ constructor( fun build(): AddPrice = AddPrice( - priceId, + discounts?.toImmutable(), + endDate, externalPriceId, + maximumAmount, + minimumAmount, + planPhaseOrder, price, + priceId, startDate, - endDate, - planPhaseOrder, - minimumAmount, - maximumAmount, - discounts?.toImmutable(), additionalProperties.toImmutable(), ) } @@ -2792,15 +3368,19 @@ constructor( @JsonCreator private constructor( @JsonProperty("discount_type") private val discountType: DiscountType, + @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonProperty("percentage_discount") private val percentageDiscount: Double?, @JsonProperty("usage_discount") private val usageDiscount: Double?, - @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @JsonProperty("discount_type") fun discountType(): DiscountType = discountType + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) + /** * Only available if discount_type is `percentage`. This is a number between 0 and 1. */ @@ -2814,10 +3394,6 @@ constructor( @JsonProperty("usage_discount") fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") - fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2832,17 +3408,17 @@ constructor( class Builder { private var discountType: DiscountType? = null + private var amountDiscount: String? = null private var percentageDiscount: Double? = null private var usageDiscount: Double? = null - private var amountDiscount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(discount: Discount) = apply { discountType = discount.discountType + amountDiscount = discount.amountDiscount percentageDiscount = discount.percentageDiscount usageDiscount = discount.usageDiscount - amountDiscount = discount.amountDiscount additionalProperties = discount.additionalProperties.toMutableMap() } @@ -2850,26 +3426,59 @@ constructor( this.discountType = discountType } + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: String?) = apply { + this.amountDiscount = amountDiscount + } + + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: Optional) = + amountDiscount(amountDiscount.orElse(null)) + /** * Only available if discount_type is `percentage`. This is a number between 0 * and 1. */ - fun percentageDiscount(percentageDiscount: Double) = apply { + fun percentageDiscount(percentageDiscount: Double?) = apply { this.percentageDiscount = percentageDiscount } + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(percentageDiscount as Double?) + + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun percentageDiscount(percentageDiscount: Optional) = + percentageDiscount(percentageDiscount.orElse(null) as Double?) + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for */ - fun usageDiscount(usageDiscount: Double) = apply { + fun usageDiscount(usageDiscount: Double?) = apply { this.usageDiscount = usageDiscount } - /** Only available if discount_type is `amount`. */ - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + fun usageDiscount(usageDiscount: Double) = usageDiscount(usageDiscount as Double?) + + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun usageDiscount(usageDiscount: Optional) = + usageDiscount(usageDiscount.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2896,9 +3505,9 @@ constructor( fun build(): Discount = Discount( checkNotNull(discountType) { "`discountType` is required but was not set" }, + amountDiscount, percentageDiscount, usageDiscount, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -2971,17 +3580,17 @@ constructor( return true } - return /* spotless:off */ other is Discount && discountType == other.discountType && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Discount && discountType == other.discountType && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, usageDiscount, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, percentageDiscount, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Discount{discountType=$discountType, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "Discount{discountType=$discountType, amountDiscount=$amountDiscount, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } /** The definition of a new price to create and add to the subscription. */ @@ -3770,43 +4379,41 @@ constructor( class NewSubscriptionUnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -3814,9 +4421,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -3824,6 +4428,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -3835,17 +4462,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -3854,20 +4470,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -3889,136 +4498,230 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitConfig: UnitConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitConfig: UnitConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - metadata = newSubscriptionUnitPrice.metadata - externalPriceId = newSubscriptionUnitPrice.externalPriceId + cadence = newSubscriptionUnitPrice.cadence + itemId = newSubscriptionUnitPrice.itemId + modelType = newSubscriptionUnitPrice.modelType name = newSubscriptionUnitPrice.name + unitConfig = newSubscriptionUnitPrice.unitConfig billableMetricId = newSubscriptionUnitPrice.billableMetricId - itemId = newSubscriptionUnitPrice.itemId billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey - cadence = newSubscriptionUnitPrice.cadence billingCycleConfiguration = newSubscriptionUnitPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitPrice.conversionRate - modelType = newSubscriptionUnitPrice.modelType - unitConfig = newSubscriptionUnitPrice.unitConfig currency = newSubscriptionUnitPrice.currency + externalPriceId = newSubscriptionUnitPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitPrice.metadata referenceId = newSubscriptionUnitPrice.referenceId additionalProperties = newSubscriptionUnitPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4044,21 +4747,21 @@ constructor( fun build(): NewSubscriptionUnitPrice = NewSubscriptionUnitPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -4695,60 +5398,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitConfig == other.unitConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitConfig=$unitConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -4756,9 +5457,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -4766,6 +5464,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -4777,17 +5498,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -4796,20 +5506,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -4831,139 +5534,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageConfig: PackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageConfig: PackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = apply { - metadata = newSubscriptionPackagePrice.metadata - externalPriceId = newSubscriptionPackagePrice.externalPriceId + cadence = newSubscriptionPackagePrice.cadence + itemId = newSubscriptionPackagePrice.itemId + modelType = newSubscriptionPackagePrice.modelType name = newSubscriptionPackagePrice.name + packageConfig = newSubscriptionPackagePrice.packageConfig billableMetricId = newSubscriptionPackagePrice.billableMetricId - itemId = newSubscriptionPackagePrice.itemId billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey - cadence = newSubscriptionPackagePrice.cadence billingCycleConfiguration = newSubscriptionPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionPackagePrice.conversionRate - modelType = newSubscriptionPackagePrice.modelType - packageConfig = newSubscriptionPackagePrice.packageConfig currency = newSubscriptionPackagePrice.currency + externalPriceId = newSubscriptionPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionPackagePrice.metadata referenceId = newSubscriptionPackagePrice.referenceId additionalProperties = newSubscriptionPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageConfig(packageConfig: PackageConfig) = apply { + this.packageConfig = packageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageConfig(packageConfig: PackageConfig) = apply { - this.packageConfig = packageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4989,23 +5786,23 @@ constructor( fun build(): NewSubscriptionPackagePrice = NewSubscriptionPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageConfig) { "`packageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -5664,56 +6461,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageConfig == other.packageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageConfig=$packageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionMatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -5725,9 +6520,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -5735,6 +6527,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -5746,17 +6561,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -5765,20 +6569,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -5800,61 +6597,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var matrixConfig: MatrixConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixConfig: MatrixConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = apply { - metadata = newSubscriptionMatrixPrice.metadata - externalPriceId = newSubscriptionMatrixPrice.externalPriceId + cadence = newSubscriptionMatrixPrice.cadence + itemId = newSubscriptionMatrixPrice.itemId + matrixConfig = newSubscriptionMatrixPrice.matrixConfig + modelType = newSubscriptionMatrixPrice.modelType name = newSubscriptionMatrixPrice.name billableMetricId = newSubscriptionMatrixPrice.billableMetricId - itemId = newSubscriptionMatrixPrice.itemId billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey - cadence = newSubscriptionMatrixPrice.cadence billingCycleConfiguration = newSubscriptionMatrixPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionMatrixPrice.invoicingCycleConfiguration conversionRate = newSubscriptionMatrixPrice.conversionRate - modelType = newSubscriptionMatrixPrice.modelType - matrixConfig = newSubscriptionMatrixPrice.matrixConfig currency = newSubscriptionMatrixPrice.currency + externalPriceId = newSubscriptionMatrixPrice.externalPriceId + fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionMatrixPrice.invoicingCycleConfiguration + metadata = newSubscriptionMatrixPrice.metadata referenceId = newSubscriptionMatrixPrice.referenceId additionalProperties = newSubscriptionMatrixPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = apply { + this.matrixConfig = matrixConfig } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -5862,77 +6659,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun matrixConfig(matrixConfig: MatrixConfig) = apply { - this.matrixConfig = matrixConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5958,23 +6849,23 @@ constructor( fun build(): NewSubscriptionMatrixPrice = NewSubscriptionMatrixPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixConfig) { + "`matrixConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixConfig) { - "`matrixConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -6066,16 +6957,13 @@ constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions - /** * Default per unit rate for any usage not bucketed into a specified * matrix_value @@ -6083,6 +6971,9 @@ constructor( @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues @@ -6100,20 +6991,28 @@ constructor( class Builder { - private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions.toMutableList() defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.toMutableList() matrixValues = matrixConfig.matrixValues.toMutableList() additionalProperties = matrixConfig.additionalProperties.toMutableMap() } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -6124,14 +7023,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified - * matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -6167,13 +7058,13 @@ constructor( fun build(): MatrixConfig = MatrixConfig( + checkNotNull(defaultUnitAmount) { + "`defaultUnitAmount` is required but was not set" + }, checkNotNull(dimensions) { "`dimensions` is required but was not set" } .toImmutable(), - checkNotNull(defaultUnitAmount) { - "`defaultUnitAmount` is required but was not set" - }, checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } @@ -6186,17 +7077,14 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -6205,6 +7093,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6218,24 +7109,19 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -6257,6 +7143,11 @@ constructor( } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6281,13 +7172,13 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { - "`unitAmount` is required but was not set" - }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { + "`unitAmount` is required but was not set" + }, additionalProperties.toImmutable(), ) } @@ -6297,17 +7188,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -6315,17 +7206,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -6790,60 +7681,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixConfig == other.matrixConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionMatrixPrice && cadence == other.cadence && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixConfig=$matrixConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionMatrixPrice{cadence=$cadence, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -6851,9 +7740,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -6861,6 +7747,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -6872,17 +7781,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -6891,20 +7789,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -6926,139 +7817,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredConfig: TieredConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredConfig: TieredConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = apply { - metadata = newSubscriptionTieredPrice.metadata - externalPriceId = newSubscriptionTieredPrice.externalPriceId + cadence = newSubscriptionTieredPrice.cadence + itemId = newSubscriptionTieredPrice.itemId + modelType = newSubscriptionTieredPrice.modelType name = newSubscriptionTieredPrice.name + tieredConfig = newSubscriptionTieredPrice.tieredConfig billableMetricId = newSubscriptionTieredPrice.billableMetricId - itemId = newSubscriptionTieredPrice.itemId billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey - cadence = newSubscriptionTieredPrice.cadence billingCycleConfiguration = newSubscriptionTieredPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPrice.conversionRate - modelType = newSubscriptionTieredPrice.modelType - tieredConfig = newSubscriptionTieredPrice.tieredConfig currency = newSubscriptionTieredPrice.currency + externalPriceId = newSubscriptionTieredPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPrice.metadata referenceId = newSubscriptionTieredPrice.referenceId additionalProperties = newSubscriptionTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredConfig(tieredConfig: TieredConfig) = apply { + this.tieredConfig = tieredConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredConfig(tieredConfig: TieredConfig) = apply { - this.tieredConfig = tieredConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7084,23 +8069,23 @@ constructor( fun build(): NewSubscriptionTieredPrice = NewSubscriptionTieredPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -7322,8 +8307,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("first_unit") private val firstUnit: Double, - @JsonProperty("last_unit") private val lastUnit: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("last_unit") private val lastUnit: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), @@ -7332,15 +8317,15 @@ constructor( /** Inclusive tier starting value */ @JsonProperty("first_unit") fun firstUnit(): Double = firstUnit + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** * Exclusive tier ending value. If null, this is treated as the last tier */ @JsonProperty("last_unit") fun lastUnit(): Optional = Optional.ofNullable(lastUnit) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7355,32 +8340,48 @@ constructor( class Builder { private var firstUnit: Double? = null - private var lastUnit: Double? = null private var unitAmount: String? = null + private var lastUnit: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } /** Inclusive tier starting value */ fun firstUnit(firstUnit: Double) = apply { this.firstUnit = firstUnit } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + /** * Exclusive tier ending value. If null, this is treated as the last * tier */ - fun lastUnit(lastUnit: Double) = apply { this.lastUnit = lastUnit } + fun lastUnit(lastUnit: Double?) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { @@ -7409,10 +8410,10 @@ constructor( checkNotNull(firstUnit) { "`firstUnit` is required but was not set" }, - lastUnit, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + lastUnit, additionalProperties.toImmutable(), ) } @@ -7422,17 +8423,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -7863,60 +8864,59 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredConfig == other.tieredConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredConfig=$tieredConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_bps_config") + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -7924,9 +8924,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -7934,6 +8931,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -7945,17 +8965,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -7964,21 +8973,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_bps_config") - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -8000,21 +9001,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredBpsConfig: TieredBpsConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredBpsConfig: TieredBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -8022,118 +9023,212 @@ constructor( internal fun from( newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice ) = apply { - metadata = newSubscriptionTieredBpsPrice.metadata - externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + cadence = newSubscriptionTieredBpsPrice.cadence + itemId = newSubscriptionTieredBpsPrice.itemId + modelType = newSubscriptionTieredBpsPrice.modelType name = newSubscriptionTieredBpsPrice.name + tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - itemId = newSubscriptionTieredBpsPrice.itemId billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey - cadence = newSubscriptionTieredBpsPrice.cadence billingCycleConfiguration = newSubscriptionTieredBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredBpsPrice.conversionRate - modelType = newSubscriptionTieredBpsPrice.modelType - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig currency = newSubscriptionTieredBpsPrice.currency + externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredBpsPrice.metadata referenceId = newSubscriptionTieredBpsPrice.referenceId additionalProperties = newSubscriptionTieredBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { + this.tieredBpsConfig = tieredBpsConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { - this.tieredBpsConfig = tieredBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8159,23 +9254,23 @@ constructor( fun build(): NewSubscriptionTieredBpsPrice = NewSubscriptionTieredBpsPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredBpsConfig) { "`tieredBpsConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -8402,15 +9497,18 @@ constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") private val bps: Double, @JsonProperty("minimum_amount") private val minimumAmount: String, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("bps") private val bps: Double, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + @JsonProperty("bps") fun bps(): Double = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount @@ -8418,9 +9516,6 @@ constructor( @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Per-event basis point rate */ - @JsonProperty("bps") fun bps(): Double = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -8438,40 +9533,48 @@ constructor( class Builder { + private var bps: Double? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var bps: Double? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8496,11 +9599,11 @@ constructor( fun build(): Tier = Tier( + checkNotNull(bps) { "`bps` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, maximumAmount, - checkNotNull(bps) { "`bps` is required but was not set" }, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -8511,17 +9614,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -8952,56 +10055,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredBpsConfig == other.tieredBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredBpsConfig=$tieredBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredBpsPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bps_config") private val bpsConfig: BpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bps_config") private val bpsConfig: BpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -9013,9 +10114,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -9023,6 +10121,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -9034,17 +10155,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -9053,20 +10163,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -9088,59 +10191,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bpsConfig: BpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bpsConfig: BpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - metadata = newSubscriptionBpsPrice.metadata - externalPriceId = newSubscriptionBpsPrice.externalPriceId + bpsConfig = newSubscriptionBpsPrice.bpsConfig + cadence = newSubscriptionBpsPrice.cadence + itemId = newSubscriptionBpsPrice.itemId + modelType = newSubscriptionBpsPrice.modelType name = newSubscriptionBpsPrice.name billableMetricId = newSubscriptionBpsPrice.billableMetricId - itemId = newSubscriptionBpsPrice.itemId billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBpsPrice.cadence billingCycleConfiguration = newSubscriptionBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBpsPrice.conversionRate - modelType = newSubscriptionBpsPrice.modelType - bpsConfig = newSubscriptionBpsPrice.bpsConfig currency = newSubscriptionBpsPrice.currency + externalPriceId = newSubscriptionBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBpsPrice.metadata referenceId = newSubscriptionBpsPrice.referenceId additionalProperties = newSubscriptionBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -9149,75 +10250,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9243,21 +10440,21 @@ constructor( fun build(): NewSubscriptionBpsPrice = NewSubscriptionBpsPrice( - metadata, - externalPriceId, + checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -9309,10 +10506,14 @@ constructor( fun bps(bps: Double) = apply { this.bps = bps } /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9905,56 +11106,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bpsConfig == other.bpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bpsConfig=$bpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -9966,9 +11165,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -9976,6 +11172,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -9987,17 +11206,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -10006,20 +11214,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -10041,61 +11242,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkBpsConfig: BulkBpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkBpsConfig: BulkBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = apply { - metadata = newSubscriptionBulkBpsPrice.metadata - externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig + cadence = newSubscriptionBulkBpsPrice.cadence + itemId = newSubscriptionBulkBpsPrice.itemId + modelType = newSubscriptionBulkBpsPrice.modelType name = newSubscriptionBulkBpsPrice.name billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - itemId = newSubscriptionBulkBpsPrice.itemId billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBulkBpsPrice.cadence billingCycleConfiguration = newSubscriptionBulkBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkBpsPrice.conversionRate - modelType = newSubscriptionBulkBpsPrice.modelType - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig currency = newSubscriptionBulkBpsPrice.currency + externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkBpsPrice.metadata referenceId = newSubscriptionBulkBpsPrice.referenceId additionalProperties = newSubscriptionBulkBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { + this.bulkBpsConfig = bulkBpsConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -10103,77 +11304,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { - this.bulkBpsConfig = bulkBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10199,23 +11494,23 @@ constructor( fun build(): NewSubscriptionBulkBpsPrice = NewSubscriptionBulkBpsPrice( - metadata, - externalPriceId, + checkNotNull(bulkBpsConfig) { + "`bulkBpsConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkBpsConfig) { - "`bulkBpsConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -10307,21 +11602,21 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("bps") private val bps: Double, + @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + @JsonProperty("bps") fun bps(): Double = bps + /** Upper bound for tier */ @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Basis points to rate on */ - @JsonProperty("bps") fun bps(): Double = bps - /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -10339,33 +11634,41 @@ constructor( class Builder { - private var maximumAmount: String? = null private var bps: Double? = null + private var maximumAmount: String? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10390,8 +11693,8 @@ constructor( fun build(): Tier = Tier( - maximumAmount, checkNotNull(bps) { "`bps` is required but was not set" }, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -10402,17 +11705,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -10977,56 +12280,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkBpsConfig == other.bulkBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkBpsConfig=$bulkBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -11038,9 +12339,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -11048,6 +12346,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -11059,17 +12380,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -11078,20 +12388,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -11113,59 +12416,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkConfig: BulkConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkConfig: BulkConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - metadata = newSubscriptionBulkPrice.metadata - externalPriceId = newSubscriptionBulkPrice.externalPriceId + bulkConfig = newSubscriptionBulkPrice.bulkConfig + cadence = newSubscriptionBulkPrice.cadence + itemId = newSubscriptionBulkPrice.itemId + modelType = newSubscriptionBulkPrice.modelType name = newSubscriptionBulkPrice.name billableMetricId = newSubscriptionBulkPrice.billableMetricId - itemId = newSubscriptionBulkPrice.itemId billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey - cadence = newSubscriptionBulkPrice.cadence billingCycleConfiguration = newSubscriptionBulkPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkPrice.conversionRate - modelType = newSubscriptionBulkPrice.modelType - bulkConfig = newSubscriptionBulkPrice.bulkConfig currency = newSubscriptionBulkPrice.currency + externalPriceId = newSubscriptionBulkPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkPrice.metadata referenceId = newSubscriptionBulkPrice.referenceId additionalProperties = newSubscriptionBulkPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -11174,75 +12475,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11268,21 +12665,21 @@ constructor( fun build(): NewSubscriptionBulkPrice = NewSubscriptionBulkPrice( - metadata, - externalPriceId, + checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -11365,20 +12762,20 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Upper bound for this tier */ @JsonProperty("maximum_units") fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -11392,28 +12789,39 @@ constructor( class Builder { - private var maximumUnits: Double? = null private var unitAmount: String? = null + private var maximumUnits: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = apply { - this.maximumUnits = maximumUnits - } - /** Amount per unit */ fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double?) = apply { + this.maximumUnits = maximumUnits + } + + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(maximumUnits as Double?) + + /** Upper bound for this tier */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11438,10 +12846,10 @@ constructor( fun build(): Tier = Tier( - maximumUnits, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -11451,17 +12859,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -12026,61 +13434,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkConfig == other.bulkConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkConfig=$bulkConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("threshold_total_amount_config") + private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("threshold_total_amount_config") - private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("threshold_total_amount_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -12088,9 +13496,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -12098,6 +13503,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -12109,17 +13537,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -12128,22 +13545,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("threshold_total_amount_config") - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -12165,21 +13573,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -12188,122 +13596,216 @@ constructor( newSubscriptionThresholdTotalAmountPrice: NewSubscriptionThresholdTotalAmountPrice ) = apply { - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId + cadence = newSubscriptionThresholdTotalAmountPrice.cadence + itemId = newSubscriptionThresholdTotalAmountPrice.itemId + modelType = newSubscriptionThresholdTotalAmountPrice.modelType name = newSubscriptionThresholdTotalAmountPrice.name + thresholdTotalAmountConfig = + newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - itemId = newSubscriptionThresholdTotalAmountPrice.itemId billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration + conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate + currency = newSubscriptionThresholdTotalAmountPrice.currency + externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId fixedPriceQuantity = newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - currency = newSubscriptionThresholdTotalAmountPrice.currency + metadata = newSubscriptionThresholdTotalAmountPrice.metadata referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId additionalProperties = newSubscriptionThresholdTotalAmountPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: ThresholdTotalAmountConfig + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: ThresholdTotalAmountConfig - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12329,23 +13831,23 @@ constructor( fun build(): NewSubscriptionThresholdTotalAmountPrice = NewSubscriptionThresholdTotalAmountPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(thresholdTotalAmountConfig) { "`thresholdTotalAmountConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -12970,61 +14472,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, thresholdTotalAmountConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionThresholdTotalAmountPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionThresholdTotalAmountPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_config") + private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_config") - private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_config") + fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -13032,9 +14533,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -13042,6 +14540,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -13053,17 +14574,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -13072,21 +14582,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_config") - fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -13108,21 +14610,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageConfig: TieredPackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageConfig: TieredPackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -13130,118 +14632,212 @@ constructor( internal fun from( newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice ) = apply { - metadata = newSubscriptionTieredPackagePrice.metadata - externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + cadence = newSubscriptionTieredPackagePrice.cadence + itemId = newSubscriptionTieredPackagePrice.itemId + modelType = newSubscriptionTieredPackagePrice.modelType name = newSubscriptionTieredPackagePrice.name + tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - itemId = newSubscriptionTieredPackagePrice.itemId billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey - cadence = newSubscriptionTieredPackagePrice.cadence billingCycleConfiguration = newSubscriptionTieredPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPackagePrice.conversionRate - modelType = newSubscriptionTieredPackagePrice.modelType - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig currency = newSubscriptionTieredPackagePrice.currency + externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPackagePrice.metadata referenceId = newSubscriptionTieredPackagePrice.referenceId additionalProperties = newSubscriptionTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { + this.tieredPackageConfig = tieredPackageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { - this.tieredPackageConfig = tieredPackageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -13267,23 +14863,23 @@ constructor( fun build(): NewSubscriptionTieredPackagePrice = NewSubscriptionTieredPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredPackageConfig) { "`tieredPackageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -13907,61 +15503,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageConfig == other.tieredPackageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageConfig=$tieredPackageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_minimum_config") + private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_minimum_config") - private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_minimum_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -13969,9 +15564,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -13979,6 +15571,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -13990,17 +15605,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -14009,21 +15613,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_minimum_config") - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -14045,21 +15641,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -14067,123 +15663,217 @@ constructor( internal fun from( newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice ) = apply { - metadata = newSubscriptionTieredWithMinimumPrice.metadata - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId + cadence = newSubscriptionTieredWithMinimumPrice.cadence + itemId = newSubscriptionTieredWithMinimumPrice.itemId + modelType = newSubscriptionTieredWithMinimumPrice.modelType name = newSubscriptionTieredWithMinimumPrice.name + tieredWithMinimumConfig = + newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - itemId = newSubscriptionTieredWithMinimumPrice.itemId billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration + conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate + currency = newSubscriptionTieredWithMinimumPrice.currency + externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionTieredWithMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - modelType = newSubscriptionTieredWithMinimumPrice.modelType - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - currency = newSubscriptionTieredWithMinimumPrice.currency + metadata = newSubscriptionTieredWithMinimumPrice.metadata referenceId = newSubscriptionTieredWithMinimumPrice.referenceId additionalProperties = newSubscriptionTieredWithMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + apply { + this.tieredWithMinimumConfig = tieredWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - apply { - this.tieredWithMinimumConfig = tieredWithMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -14209,23 +15899,23 @@ constructor( fun build(): NewSubscriptionTieredWithMinimumPrice = NewSubscriptionTieredWithMinimumPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithMinimumConfig) { "`tieredWithMinimumConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -14850,61 +16540,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithMinimumConfig=$tieredWithMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithPercentPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_percent_config") + private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_percent_config") - private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_percent_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -14912,9 +16601,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -14922,6 +16608,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -14933,17 +16642,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -14952,21 +16650,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_percent_config") - fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -14988,21 +16678,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithPercentConfig: UnitWithPercentConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithPercentConfig: UnitWithPercentConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -15010,120 +16700,214 @@ constructor( internal fun from( newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice ) = apply { - metadata = newSubscriptionUnitWithPercentPrice.metadata - externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + cadence = newSubscriptionUnitWithPercentPrice.cadence + itemId = newSubscriptionUnitWithPercentPrice.itemId + modelType = newSubscriptionUnitWithPercentPrice.modelType name = newSubscriptionUnitWithPercentPrice.name + unitWithPercentConfig = + newSubscriptionUnitWithPercentPrice.unitWithPercentConfig billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - itemId = newSubscriptionUnitWithPercentPrice.itemId billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithPercentPrice.cadence billingCycleConfiguration = newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - modelType = newSubscriptionUnitWithPercentPrice.modelType - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig currency = newSubscriptionUnitWithPercentPrice.currency + externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitWithPercentPrice.metadata referenceId = newSubscriptionUnitWithPercentPrice.referenceId additionalProperties = newSubscriptionUnitWithPercentPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = + apply { + this.unitWithPercentConfig = unitWithPercentConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = - apply { - this.unitWithPercentConfig = unitWithPercentConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -15149,23 +16933,23 @@ constructor( fun build(): NewSubscriptionUnitWithPercentPrice = NewSubscriptionUnitWithPercentPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithPercentConfig) { "`unitWithPercentConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -15789,61 +17573,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithPercentConfig == other.unitWithPercentConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithPercentConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithPercentPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithPercentConfig=$unitWithPercentConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithPercentPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_with_allocation_config") + private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_with_allocation_config") - private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_with_allocation_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -15851,9 +17635,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -15861,6 +17642,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -15872,17 +17676,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -15891,22 +17684,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_with_allocation_config") - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -15928,21 +17712,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -15951,123 +17735,217 @@ constructor( newSubscriptionPackageWithAllocationPrice: NewSubscriptionPackageWithAllocationPrice ) = apply { - metadata = newSubscriptionPackageWithAllocationPrice.metadata - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId + cadence = newSubscriptionPackageWithAllocationPrice.cadence + itemId = newSubscriptionPackageWithAllocationPrice.itemId + modelType = newSubscriptionPackageWithAllocationPrice.modelType name = newSubscriptionPackageWithAllocationPrice.name + packageWithAllocationConfig = + newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig billableMetricId = newSubscriptionPackageWithAllocationPrice.billableMetricId - itemId = newSubscriptionPackageWithAllocationPrice.itemId billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate + currency = newSubscriptionPackageWithAllocationPrice.currency + externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionPackageWithAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - modelType = newSubscriptionPackageWithAllocationPrice.modelType - packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - currency = newSubscriptionPackageWithAllocationPrice.currency + metadata = newSubscriptionPackageWithAllocationPrice.metadata referenceId = newSubscriptionPackageWithAllocationPrice.referenceId additionalProperties = newSubscriptionPackageWithAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16093,23 +17971,23 @@ constructor( fun build(): NewSubscriptionPackageWithAllocationPrice = NewSubscriptionPackageWithAllocationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageWithAllocationConfig) { "`packageWithAllocationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -16735,61 +18613,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageWithAllocationConfig == other.packageWithAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageWithAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackageWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageWithAllocationConfig=$packageWithAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackageWithAllocationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTierWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_proration_config") + private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_proration_config") - private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_proration_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -16797,9 +18675,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -16807,6 +18682,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -16818,17 +18716,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -16837,22 +18724,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_proration_config") - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -16874,21 +18752,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -16896,122 +18774,216 @@ constructor( internal fun from( newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice ) = apply { - metadata = newSubscriptionTierWithProrationPrice.metadata - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId + cadence = newSubscriptionTierWithProrationPrice.cadence + itemId = newSubscriptionTierWithProrationPrice.itemId + modelType = newSubscriptionTierWithProrationPrice.modelType name = newSubscriptionTierWithProrationPrice.name + tieredWithProrationConfig = + newSubscriptionTierWithProrationPrice.tieredWithProrationConfig billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - itemId = newSubscriptionTierWithProrationPrice.itemId billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTierWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionTierWithProrationPrice.conversionRate + currency = newSubscriptionTierWithProrationPrice.currency + externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionTierWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTierWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionTierWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - modelType = newSubscriptionTierWithProrationPrice.modelType - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - currency = newSubscriptionTierWithProrationPrice.currency + metadata = newSubscriptionTierWithProrationPrice.metadata referenceId = newSubscriptionTierWithProrationPrice.referenceId additionalProperties = newSubscriptionTierWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithProrationConfig( + tieredWithProrationConfig: TieredWithProrationConfig + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredWithProrationConfig( - tieredWithProrationConfig: TieredWithProrationConfig - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -17037,23 +19009,23 @@ constructor( fun build(): NewSubscriptionTierWithProrationPrice = NewSubscriptionTierWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithProrationConfig) { "`tieredWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -17678,61 +19650,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithProrationConfig == other.tieredWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTierWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithProrationConfig=$tieredWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTierWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_proration_config") + private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_proration_config") - private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -17740,9 +19711,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -17750,6 +19718,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -17761,17 +19752,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -17780,21 +19760,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_proration_config") - fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -17816,21 +19788,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithProrationConfig: UnitWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithProrationConfig: UnitWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -17838,123 +19810,217 @@ constructor( internal fun from( newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice ) = apply { - metadata = newSubscriptionUnitWithProrationPrice.metadata - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId + cadence = newSubscriptionUnitWithProrationPrice.cadence + itemId = newSubscriptionUnitWithProrationPrice.itemId + modelType = newSubscriptionUnitWithProrationPrice.modelType name = newSubscriptionUnitWithProrationPrice.name + unitWithProrationConfig = + newSubscriptionUnitWithProrationPrice.unitWithProrationConfig billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - itemId = newSubscriptionUnitWithProrationPrice.itemId billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionUnitWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate + currency = newSubscriptionUnitWithProrationPrice.currency + externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionUnitWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - modelType = newSubscriptionUnitWithProrationPrice.modelType - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - currency = newSubscriptionUnitWithProrationPrice.currency + metadata = newSubscriptionUnitWithProrationPrice.metadata referenceId = newSubscriptionUnitWithProrationPrice.referenceId additionalProperties = newSubscriptionUnitWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + apply { + this.unitWithProrationConfig = unitWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - apply { - this.unitWithProrationConfig = unitWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -17980,23 +20046,23 @@ constructor( fun build(): NewSubscriptionUnitWithProrationPrice = NewSubscriptionUnitWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithProrationConfig) { "`unitWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -18621,57 +20687,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithProrationConfig == other.unitWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithProrationConfig=$unitWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_allocation_config") + private val groupedAllocationConfig: GroupedAllocationConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_allocation_config") - private val groupedAllocationConfig: GroupedAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_allocation_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -18683,9 +20748,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -18693,6 +20755,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -18704,17 +20789,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -18723,21 +20797,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_allocation_config") - fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -18759,21 +20825,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedAllocationConfig: GroupedAllocationConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedAllocationConfig: GroupedAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -18781,43 +20847,44 @@ constructor( internal fun from( newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice ) = apply { - metadata = newSubscriptionGroupedAllocationPrice.metadata - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId + cadence = newSubscriptionGroupedAllocationPrice.cadence + groupedAllocationConfig = + newSubscriptionGroupedAllocationPrice.groupedAllocationConfig + itemId = newSubscriptionGroupedAllocationPrice.itemId + modelType = newSubscriptionGroupedAllocationPrice.modelType name = newSubscriptionGroupedAllocationPrice.name billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - itemId = newSubscriptionGroupedAllocationPrice.itemId billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate + currency = newSubscriptionGroupedAllocationPrice.currency + externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - modelType = newSubscriptionGroupedAllocationPrice.modelType - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - currency = newSubscriptionGroupedAllocationPrice.currency + metadata = newSubscriptionGroupedAllocationPrice.metadata referenceId = newSubscriptionGroupedAllocationPrice.referenceId additionalProperties = newSubscriptionGroupedAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + apply { + this.groupedAllocationConfig = groupedAllocationConfig + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -18826,78 +20893,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - apply { - this.groupedAllocationConfig = groupedAllocationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -18923,23 +21083,23 @@ constructor( fun build(): NewSubscriptionGroupedAllocationPrice = NewSubscriptionGroupedAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedAllocationConfig) { + "`groupedAllocationConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedAllocationConfig) { - "`groupedAllocationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -19564,57 +21724,57 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedAllocationConfig == other.groupedAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && cadence == other.cadence && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedAllocationConfig=$groupedAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedAllocationPrice{cadence=$cadence, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_with_prorated_minimum_config") + private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_prorated_minimum_config") - private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_with_prorated_minimum_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -19626,9 +21786,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -19636,6 +21793,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -19647,17 +21827,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -19666,22 +21835,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_prorated_minimum_config") - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -19703,23 +21863,23 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedWithProratedMinimumConfig: + GroupedWithProratedMinimumConfig? = + null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithProratedMinimumConfig: - GroupedWithProratedMinimumConfig? = - null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -19728,50 +21888,52 @@ constructor( newSubscriptionGroupedWithProratedMinimumPrice: NewSubscriptionGroupedWithProratedMinimumPrice ) = apply { - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId + cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence + groupedWithProratedMinimumConfig = + newSubscriptionGroupedWithProratedMinimumPrice + .groupedWithProratedMinimumConfig + itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId + modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType name = newSubscriptionGroupedWithProratedMinimumPrice.name billableMetricId = newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId billedInAdvance = newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration + conversionRate = + newSubscriptionGroupedWithProratedMinimumPrice.conversionRate + currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + externalPriceId = + newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedWithProratedMinimumPrice .invoicingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId additionalProperties = newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -19779,79 +21941,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { - this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19877,23 +22131,23 @@ constructor( fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = NewSubscriptionGroupedWithProratedMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedWithProratedMinimumConfig) { + "`groupedWithProratedMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithProratedMinimumConfig) { - "`groupedWithProratedMinimumConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -20520,57 +22774,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && cadence == other.cadence && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithProratedMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithProratedMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedWithProratedMinimumPrice{cadence=$cadence, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_with_proration_config") + private val bulkWithProrationConfig: BulkWithProrationConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_with_proration_config") - private val bulkWithProrationConfig: BulkWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_with_proration_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -20582,9 +22835,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -20592,6 +22842,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -20603,17 +22876,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -20622,21 +22884,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_with_proration_config") - fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -20658,21 +22912,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkWithProrationConfig: BulkWithProrationConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkWithProrationConfig: BulkWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -20680,43 +22934,44 @@ constructor( internal fun from( newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice ) = apply { - metadata = newSubscriptionBulkWithProrationPrice.metadata - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId + bulkWithProrationConfig = + newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig + cadence = newSubscriptionBulkWithProrationPrice.cadence + itemId = newSubscriptionBulkWithProrationPrice.itemId + modelType = newSubscriptionBulkWithProrationPrice.modelType name = newSubscriptionBulkWithProrationPrice.name billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - itemId = newSubscriptionBulkWithProrationPrice.itemId billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionBulkWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate + currency = newSubscriptionBulkWithProrationPrice.currency + externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionBulkWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionBulkWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - modelType = newSubscriptionBulkWithProrationPrice.modelType - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - currency = newSubscriptionBulkWithProrationPrice.currency + metadata = newSubscriptionBulkWithProrationPrice.metadata referenceId = newSubscriptionBulkWithProrationPrice.referenceId additionalProperties = newSubscriptionBulkWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + apply { + this.bulkWithProrationConfig = bulkWithProrationConfig + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -20725,78 +22980,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - apply { - this.bulkWithProrationConfig = bulkWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20822,23 +23170,23 @@ constructor( fun build(): NewSubscriptionBulkWithProrationPrice = NewSubscriptionBulkWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(bulkWithProrationConfig) { + "`bulkWithProrationConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkWithProrationConfig) { - "`bulkWithProrationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -21463,17 +23811,17 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkWithProrationConfig == other.bulkWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } @@ -21482,17 +23830,17 @@ constructor( return true } - return /* spotless:off */ other is AddPrice && priceId == other.priceId && externalPriceId == other.externalPriceId && price == other.price && startDate == other.startDate && endDate == other.endDate && planPhaseOrder == other.planPhaseOrder && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && discounts == other.discounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddPrice && discounts == other.discounts && endDate == other.endDate && externalPriceId == other.externalPriceId && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && price == other.price && priceId == other.priceId && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, externalPriceId, price, startDate, endDate, planPhaseOrder, minimumAmount, maximumAmount, discounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(discounts, endDate, externalPriceId, maximumAmount, minimumAmount, planPhaseOrder, price, priceId, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddPrice{priceId=$priceId, externalPriceId=$externalPriceId, price=$price, startDate=$startDate, endDate=$endDate, planPhaseOrder=$planPhaseOrder, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, discounts=$discounts, additionalProperties=$additionalProperties}" + "AddPrice{discounts=$discounts, endDate=$endDate, externalPriceId=$externalPriceId, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, price=$price, priceId=$priceId, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -21566,13 +23914,39 @@ constructor( * The month on which the billing cycle is anchored (e.g. a quarterly price anchored in * February would have cycles starting February, May, August, and November). */ - fun month(month: Long) = apply { this.month = month } + fun month(month: Long?) = apply { this.month = month } + + /** + * The month on which the billing cycle is anchored (e.g. a quarterly price anchored in + * February would have cycles starting February, May, August, and November). + */ + fun month(month: Long) = month(month as Long?) + + /** + * The month on which the billing cycle is anchored (e.g. a quarterly price anchored in + * February would have cycles starting February, May, August, and November). + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun month(month: Optional) = month(month.orElse(null) as Long?) + + /** + * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored + * on 2021 would have cycles starting on 2021, 2023, 2025, etc.). + */ + fun year(year: Long?) = apply { this.year = year } /** * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored * on 2021 would have cycles starting on 2021, 2023, 2025, etc.). */ - fun year(year: Long) = apply { this.year = year } + fun year(year: Long) = year(year as Long?) + + /** + * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored + * on 2021 would have cycles starting on 2021, 2023, 2025, etc.). + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun year(year: Optional) = year(year.orElse(null) as Long?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -21840,19 +24214,19 @@ constructor( class RemovePrice @JsonCreator private constructor( - @JsonProperty("price_id") private val priceId: String?, @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("price_id") private val priceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the price to remove on the subscription. */ - @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) - /** The external price id of the price to remove on the subscription. */ @JsonProperty("external_price_id") fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the price to remove on the subscription. */ + @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -21866,25 +24240,32 @@ constructor( class Builder { - private var priceId: String? = null private var externalPriceId: String? = null + private var priceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(removePrice: RemovePrice) = apply { - priceId = removePrice.priceId externalPriceId = removePrice.externalPriceId + priceId = removePrice.priceId additionalProperties = removePrice.additionalProperties.toMutableMap() } - /** The id of the price to remove on the subscription. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } - /** The external price id of the price to remove on the subscription. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** The external price id of the price to remove on the subscription. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** The id of the price to remove on the subscription. */ + fun priceId(priceId: String?) = apply { this.priceId = priceId } + + /** The id of the price to remove on the subscription. */ + fun priceId(priceId: Optional) = priceId(priceId.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -21906,8 +24287,8 @@ constructor( fun build(): RemovePrice = RemovePrice( - priceId, externalPriceId, + priceId, additionalProperties.toImmutable(), ) } @@ -21917,17 +24298,17 @@ constructor( return true } - return /* spotless:off */ other is RemovePrice && priceId == other.priceId && externalPriceId == other.externalPriceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RemovePrice && externalPriceId == other.externalPriceId && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, externalPriceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalPriceId, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RemovePrice{priceId=$priceId, externalPriceId=$externalPriceId, additionalProperties=$additionalProperties}" + "RemovePrice{externalPriceId=$externalPriceId, priceId=$priceId, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -22216,18 +24597,24 @@ constructor( class NewPercentageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("percentage_discount") private val percentageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("percentage_discount") + fun percentageDiscount(): Double = percentageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -22235,12 +24622,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("percentage_discount") - fun percentageDiscount(): Double = percentageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22254,22 +24635,26 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var percentageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel adjustmentType = newPercentageDiscount.adjustmentType + appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() percentageDiscount = newPercentageDiscount.percentageDiscount + isInvoiceLevel = newPercentageDiscount.isInvoiceLevel additionalProperties = newPercentageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22281,21 +24666,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun percentageDiscount(percentageDiscount: Double) = apply { + this.percentageDiscount = percentageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun percentageDiscount(percentageDiscount: Double) = apply { - this.percentageDiscount = percentageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22321,17 +24717,17 @@ constructor( fun build(): NewPercentageDiscount = NewPercentageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(percentageDiscount) { "`percentageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22393,35 +24789,40 @@ constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, percentageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewUsageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("usage_discount") private val usageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -22429,11 +24830,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22447,21 +24843,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var usageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newUsageDiscount.isInvoiceLevel adjustmentType = newUsageDiscount.adjustmentType + appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() usageDiscount = newUsageDiscount.usageDiscount + isInvoiceLevel = newUsageDiscount.isInvoiceLevel additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22473,21 +24873,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun usageDiscount(usageDiscount: Double) = apply { + this.usageDiscount = usageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun usageDiscount(usageDiscount: Double) = apply { - this.usageDiscount = usageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22513,17 +24924,17 @@ constructor( fun build(): NewUsageDiscount = NewUsageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(usageDiscount) { "`usageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22585,31 +24996,36 @@ constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, usageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewAmountDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, @JsonProperty("amount_discount") private val amountDiscount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + + @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds @@ -22621,11 +25037,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22639,21 +25050,29 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null + private var appliesToPriceIds: MutableList? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newAmountDiscount.isInvoiceLevel adjustmentType = newAmountDiscount.adjustmentType amountDiscount = newAmountDiscount.amountDiscount + appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() + isInvoiceLevel = newAmountDiscount.isInvoiceLevel additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + + fun amountDiscount(amountDiscount: String) = apply { + this.amountDiscount = amountDiscount + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22669,17 +25088,24 @@ constructor( * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22705,17 +25131,17 @@ constructor( fun build(): NewAmountDiscount = NewAmountDiscount( - checkNotNull(appliesToPriceIds) { - "`appliesToPriceIds` is required but was not set" - } - .toImmutable(), - isInvoiceLevel, checkNotNull(adjustmentType) { "`adjustmentType` is required but was not set" }, checkNotNull(amountDiscount) { "`amountDiscount` is required but was not set" }, + checkNotNull(appliesToPriceIds) { + "`appliesToPriceIds` is required but was not set" + } + .toImmutable(), + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22777,36 +25203,44 @@ constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMinimum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, - @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("item_id") private val itemId: String, + @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -22814,14 +25248,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount - - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") fun itemId(): String = itemId - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22835,23 +25261,27 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null - private var minimumAmount: String? = null + private var appliesToPriceIds: MutableList? = null private var itemId: String? = null + private var minimumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMinimum: NewMinimum) = apply { - appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMinimum.isInvoiceLevel adjustmentType = newMinimum.adjustmentType - minimumAmount = newMinimum.minimumAmount + appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() itemId = newMinimum.itemId + minimumAmount = newMinimum.minimumAmount + isInvoiceLevel = newMinimum.isInvoiceLevel additionalProperties = newMinimum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22863,24 +25293,35 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun minimumAmount(minimumAmount: String) = apply { + this.minimumAmount = minimumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } - - fun minimumAmount(minimumAmount: String) = apply { - this.minimumAmount = minimumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22906,18 +25347,18 @@ constructor( fun build(): NewMinimum = NewMinimum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, - checkNotNull(itemId) { "`itemId` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22979,35 +25420,40 @@ constructor( return true } - return /* spotless:off */ other is NewMinimum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMinimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, itemId, minimumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMaximum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("maximum_amount") private val maximumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -23015,11 +25461,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -23033,21 +25474,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var maximumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMaximum: NewMaximum) = apply { - appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMaximum.isInvoiceLevel adjustmentType = newMaximum.adjustmentType + appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() maximumAmount = newMaximum.maximumAmount + isInvoiceLevel = newMaximum.isInvoiceLevel additionalProperties = newMaximum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -23059,21 +25504,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun maximumAmount(maximumAmount: String) = apply { + this.maximumAmount = maximumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun maximumAmount(maximumAmount: String) = apply { - this.maximumAmount = maximumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23099,17 +25555,17 @@ constructor( fun build(): NewMaximum = NewMaximum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(maximumAmount) { "`maximumAmount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -23171,17 +25627,17 @@ constructor( return true } - return /* spotless:off */ other is NewMaximum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, maximumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -23207,42 +25663,36 @@ constructor( class ReplacePrice @JsonCreator private constructor( - @JsonProperty("price_id") private val priceId: String?, + @JsonProperty("replaces_price_id") private val replacesPriceId: String, + @JsonProperty("discounts") private val discounts: List?, @JsonProperty("external_price_id") private val externalPriceId: String?, - @JsonProperty("price") private val price: Price?, @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("replaces_price_id") private val replacesPriceId: String, - @JsonProperty("minimum_amount") private val minimumAmount: String?, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("discounts") private val discounts: List?, + @JsonProperty("minimum_amount") private val minimumAmount: String?, + @JsonProperty("price") private val price: Price?, + @JsonProperty("price_id") private val priceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the price to add to the subscription. */ - @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) + /** The id of the price on the plan to replace in the subscription. */ + @JsonProperty("replaces_price_id") fun replacesPriceId(): String = replacesPriceId + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + @JsonProperty("discounts") + fun discounts(): Optional> = Optional.ofNullable(discounts) /** The external price id of the price to add to the subscription. */ @JsonProperty("external_price_id") fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) - /** The definition of a new price to create and add to the subscription. */ - @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) - /** The new quantity of the price, if the price is a fixed price. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) - /** The id of the price on the plan to replace in the subscription. */ - @JsonProperty("replaces_price_id") fun replacesPriceId(): String = replacesPriceId - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the - * replacement price. - */ - @JsonProperty("minimum_amount") - fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) - /** * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the * replacement price. @@ -23251,11 +25701,17 @@ constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the * replacement price. */ - @JsonProperty("discounts") - fun discounts(): Optional> = Optional.ofNullable(discounts) + @JsonProperty("minimum_amount") + fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + + /** The definition of a new price to create and add to the subscription. */ + @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) + + /** The id of the price to add to the subscription. */ + @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) @JsonAnyGetter @ExcludeMissing @@ -23270,39 +25726,110 @@ constructor( class Builder { - private var priceId: String? = null + private var replacesPriceId: String? = null + private var discounts: MutableList? = null private var externalPriceId: String? = null - private var price: Price? = null private var fixedPriceQuantity: Double? = null - private var replacesPriceId: String? = null - private var minimumAmount: String? = null private var maximumAmount: String? = null - private var discounts: MutableList? = null + private var minimumAmount: String? = null + private var price: Price? = null + private var priceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(replacePrice: ReplacePrice) = apply { - priceId = replacePrice.priceId + replacesPriceId = replacePrice.replacesPriceId + discounts = replacePrice.discounts?.toMutableList() externalPriceId = replacePrice.externalPriceId - price = replacePrice.price fixedPriceQuantity = replacePrice.fixedPriceQuantity - replacesPriceId = replacePrice.replacesPriceId - minimumAmount = replacePrice.minimumAmount maximumAmount = replacePrice.maximumAmount - discounts = replacePrice.discounts?.toMutableList() + minimumAmount = replacePrice.minimumAmount + price = replacePrice.price + priceId = replacePrice.priceId additionalProperties = replacePrice.additionalProperties.toMutableMap() } - /** The id of the price to add to the subscription. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } + /** The id of the price on the plan to replace in the subscription. */ + fun replacesPriceId(replacesPriceId: String) = apply { + this.replacesPriceId = replacesPriceId + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun discounts(discounts: List?) = apply { + this.discounts = discounts?.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun discounts(discounts: Optional>) = discounts(discounts.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } /** The external price id of the price to add to the subscription. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** The external price id of the price to add to the subscription. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** The new quantity of the price, if the price is a fixed price. */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The new quantity of the price, if the price is a fixed price. */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** The new quantity of the price, if the price is a fixed price. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the + * replacement price. + */ + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the + * replacement price. + */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the + * replacement price. + */ + fun minimumAmount(minimumAmount: String?) = apply { this.minimumAmount = minimumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the + * replacement price. + */ + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null)) + + /** The definition of a new price to create and add to the subscription. */ + fun price(price: Price?) = apply { this.price = price } + /** The definition of a new price to create and add to the subscription. */ - fun price(price: Price) = apply { this.price = price } + fun price(price: Optional) = price(price.orElse(null)) fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) @@ -23424,43 +25951,11 @@ constructor( ) } - /** The new quantity of the price, if the price is a fixed price. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The id of the price on the plan to replace in the subscription. */ - fun replacesPriceId(replacesPriceId: String) = apply { - this.replacesPriceId = replacesPriceId - } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the - * replacement price. - */ - fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the - * replacement price. - */ - fun maximumAmount(maximumAmount: String) = apply { this.maximumAmount = maximumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the - * replacement price. - */ - fun discounts(discounts: List) = apply { - this.discounts = discounts.toMutableList() - } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: String?) = apply { this.priceId = priceId } - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the - * replacement price. - */ - fun addDiscount(discount: Discount) = apply { - discounts = (discounts ?: mutableListOf()).apply { add(discount) } - } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: Optional) = priceId(priceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23483,16 +25978,16 @@ constructor( fun build(): ReplacePrice = ReplacePrice( - priceId, - externalPriceId, - price, - fixedPriceQuantity, checkNotNull(replacesPriceId) { "`replacesPriceId` is required but was not set" }, - minimumAmount, - maximumAmount, discounts?.toImmutable(), + externalPriceId, + fixedPriceQuantity, + maximumAmount, + minimumAmount, + price, + priceId, additionalProperties.toImmutable(), ) } @@ -23502,15 +25997,19 @@ constructor( @JsonCreator private constructor( @JsonProperty("discount_type") private val discountType: DiscountType, + @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonProperty("percentage_discount") private val percentageDiscount: Double?, @JsonProperty("usage_discount") private val usageDiscount: Double?, - @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @JsonProperty("discount_type") fun discountType(): DiscountType = discountType + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) + /** * Only available if discount_type is `percentage`. This is a number between 0 and 1. */ @@ -23524,10 +26023,6 @@ constructor( @JsonProperty("usage_discount") fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") - fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -23542,17 +26037,17 @@ constructor( class Builder { private var discountType: DiscountType? = null + private var amountDiscount: String? = null private var percentageDiscount: Double? = null private var usageDiscount: Double? = null - private var amountDiscount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(discount: Discount) = apply { discountType = discount.discountType + amountDiscount = discount.amountDiscount percentageDiscount = discount.percentageDiscount usageDiscount = discount.usageDiscount - amountDiscount = discount.amountDiscount additionalProperties = discount.additionalProperties.toMutableMap() } @@ -23560,26 +26055,59 @@ constructor( this.discountType = discountType } + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: String?) = apply { + this.amountDiscount = amountDiscount + } + + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: Optional) = + amountDiscount(amountDiscount.orElse(null)) + /** * Only available if discount_type is `percentage`. This is a number between 0 * and 1. */ - fun percentageDiscount(percentageDiscount: Double) = apply { + fun percentageDiscount(percentageDiscount: Double?) = apply { this.percentageDiscount = percentageDiscount } + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(percentageDiscount as Double?) + + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun percentageDiscount(percentageDiscount: Optional) = + percentageDiscount(percentageDiscount.orElse(null) as Double?) + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for */ - fun usageDiscount(usageDiscount: Double) = apply { + fun usageDiscount(usageDiscount: Double?) = apply { this.usageDiscount = usageDiscount } - /** Only available if discount_type is `amount`. */ - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + fun usageDiscount(usageDiscount: Double) = usageDiscount(usageDiscount as Double?) + + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun usageDiscount(usageDiscount: Optional) = + usageDiscount(usageDiscount.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23606,9 +26134,9 @@ constructor( fun build(): Discount = Discount( checkNotNull(discountType) { "`discountType` is required but was not set" }, + amountDiscount, percentageDiscount, usageDiscount, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -23681,17 +26209,17 @@ constructor( return true } - return /* spotless:off */ other is Discount && discountType == other.discountType && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Discount && discountType == other.discountType && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, usageDiscount, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, percentageDiscount, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Discount{discountType=$discountType, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "Discount{discountType=$discountType, amountDiscount=$amountDiscount, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } /** The definition of a new price to create and add to the subscription. */ @@ -24480,43 +27008,41 @@ constructor( class NewSubscriptionUnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -24524,9 +27050,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -24534,6 +27057,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -24545,17 +27091,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -24564,20 +27099,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -24599,136 +27127,230 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitConfig: UnitConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitConfig: UnitConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - metadata = newSubscriptionUnitPrice.metadata - externalPriceId = newSubscriptionUnitPrice.externalPriceId + cadence = newSubscriptionUnitPrice.cadence + itemId = newSubscriptionUnitPrice.itemId + modelType = newSubscriptionUnitPrice.modelType name = newSubscriptionUnitPrice.name + unitConfig = newSubscriptionUnitPrice.unitConfig billableMetricId = newSubscriptionUnitPrice.billableMetricId - itemId = newSubscriptionUnitPrice.itemId billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey - cadence = newSubscriptionUnitPrice.cadence billingCycleConfiguration = newSubscriptionUnitPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitPrice.conversionRate - modelType = newSubscriptionUnitPrice.modelType - unitConfig = newSubscriptionUnitPrice.unitConfig currency = newSubscriptionUnitPrice.currency + externalPriceId = newSubscriptionUnitPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitPrice.metadata referenceId = newSubscriptionUnitPrice.referenceId additionalProperties = newSubscriptionUnitPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -24754,21 +27376,21 @@ constructor( fun build(): NewSubscriptionUnitPrice = NewSubscriptionUnitPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -25405,60 +28027,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitConfig == other.unitConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitConfig=$unitConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -25466,9 +28086,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -25476,6 +28093,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -25487,17 +28127,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -25506,20 +28135,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -25541,139 +28163,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageConfig: PackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageConfig: PackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = apply { - metadata = newSubscriptionPackagePrice.metadata - externalPriceId = newSubscriptionPackagePrice.externalPriceId + cadence = newSubscriptionPackagePrice.cadence + itemId = newSubscriptionPackagePrice.itemId + modelType = newSubscriptionPackagePrice.modelType name = newSubscriptionPackagePrice.name + packageConfig = newSubscriptionPackagePrice.packageConfig billableMetricId = newSubscriptionPackagePrice.billableMetricId - itemId = newSubscriptionPackagePrice.itemId billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey - cadence = newSubscriptionPackagePrice.cadence billingCycleConfiguration = newSubscriptionPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionPackagePrice.conversionRate - modelType = newSubscriptionPackagePrice.modelType - packageConfig = newSubscriptionPackagePrice.packageConfig currency = newSubscriptionPackagePrice.currency + externalPriceId = newSubscriptionPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionPackagePrice.metadata referenceId = newSubscriptionPackagePrice.referenceId additionalProperties = newSubscriptionPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageConfig(packageConfig: PackageConfig) = apply { + this.packageConfig = packageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageConfig(packageConfig: PackageConfig) = apply { - this.packageConfig = packageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -25699,23 +28415,23 @@ constructor( fun build(): NewSubscriptionPackagePrice = NewSubscriptionPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageConfig) { "`packageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -26374,56 +29090,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageConfig == other.packageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageConfig=$packageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionMatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -26435,9 +29149,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -26445,6 +29156,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -26456,17 +29190,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -26475,20 +29198,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -26510,61 +29226,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var matrixConfig: MatrixConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixConfig: MatrixConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = apply { - metadata = newSubscriptionMatrixPrice.metadata - externalPriceId = newSubscriptionMatrixPrice.externalPriceId + cadence = newSubscriptionMatrixPrice.cadence + itemId = newSubscriptionMatrixPrice.itemId + matrixConfig = newSubscriptionMatrixPrice.matrixConfig + modelType = newSubscriptionMatrixPrice.modelType name = newSubscriptionMatrixPrice.name billableMetricId = newSubscriptionMatrixPrice.billableMetricId - itemId = newSubscriptionMatrixPrice.itemId billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey - cadence = newSubscriptionMatrixPrice.cadence billingCycleConfiguration = newSubscriptionMatrixPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionMatrixPrice.invoicingCycleConfiguration conversionRate = newSubscriptionMatrixPrice.conversionRate - modelType = newSubscriptionMatrixPrice.modelType - matrixConfig = newSubscriptionMatrixPrice.matrixConfig currency = newSubscriptionMatrixPrice.currency + externalPriceId = newSubscriptionMatrixPrice.externalPriceId + fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionMatrixPrice.invoicingCycleConfiguration + metadata = newSubscriptionMatrixPrice.metadata referenceId = newSubscriptionMatrixPrice.referenceId additionalProperties = newSubscriptionMatrixPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = apply { + this.matrixConfig = matrixConfig } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -26572,77 +29288,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun matrixConfig(matrixConfig: MatrixConfig) = apply { - this.matrixConfig = matrixConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26668,23 +29478,23 @@ constructor( fun build(): NewSubscriptionMatrixPrice = NewSubscriptionMatrixPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixConfig) { + "`matrixConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixConfig) { - "`matrixConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -26776,16 +29586,13 @@ constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions - /** * Default per unit rate for any usage not bucketed into a specified * matrix_value @@ -26793,6 +29600,9 @@ constructor( @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues @@ -26810,20 +29620,28 @@ constructor( class Builder { - private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions.toMutableList() defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.toMutableList() matrixValues = matrixConfig.matrixValues.toMutableList() additionalProperties = matrixConfig.additionalProperties.toMutableMap() } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -26834,14 +29652,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified - * matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -26877,13 +29687,13 @@ constructor( fun build(): MatrixConfig = MatrixConfig( + checkNotNull(defaultUnitAmount) { + "`defaultUnitAmount` is required but was not set" + }, checkNotNull(dimensions) { "`dimensions` is required but was not set" } .toImmutable(), - checkNotNull(defaultUnitAmount) { - "`defaultUnitAmount` is required but was not set" - }, checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } @@ -26896,17 +29706,14 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -26915,6 +29722,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26928,24 +29738,19 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -26967,6 +29772,11 @@ constructor( } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26991,13 +29801,13 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { - "`unitAmount` is required but was not set" - }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { + "`unitAmount` is required but was not set" + }, additionalProperties.toImmutable(), ) } @@ -27007,17 +29817,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -27025,17 +29835,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -27500,60 +30310,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixConfig == other.matrixConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionMatrixPrice && cadence == other.cadence && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixConfig=$matrixConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionMatrixPrice{cadence=$cadence, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -27561,9 +30369,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -27571,6 +30376,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -27582,17 +30410,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -27601,20 +30418,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -27636,139 +30446,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredConfig: TieredConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredConfig: TieredConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = apply { - metadata = newSubscriptionTieredPrice.metadata - externalPriceId = newSubscriptionTieredPrice.externalPriceId + cadence = newSubscriptionTieredPrice.cadence + itemId = newSubscriptionTieredPrice.itemId + modelType = newSubscriptionTieredPrice.modelType name = newSubscriptionTieredPrice.name + tieredConfig = newSubscriptionTieredPrice.tieredConfig billableMetricId = newSubscriptionTieredPrice.billableMetricId - itemId = newSubscriptionTieredPrice.itemId billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey - cadence = newSubscriptionTieredPrice.cadence billingCycleConfiguration = newSubscriptionTieredPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPrice.conversionRate - modelType = newSubscriptionTieredPrice.modelType - tieredConfig = newSubscriptionTieredPrice.tieredConfig currency = newSubscriptionTieredPrice.currency + externalPriceId = newSubscriptionTieredPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPrice.metadata referenceId = newSubscriptionTieredPrice.referenceId additionalProperties = newSubscriptionTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredConfig(tieredConfig: TieredConfig) = apply { + this.tieredConfig = tieredConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredConfig(tieredConfig: TieredConfig) = apply { - this.tieredConfig = tieredConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -27794,23 +30698,23 @@ constructor( fun build(): NewSubscriptionTieredPrice = NewSubscriptionTieredPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -28032,8 +30936,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("first_unit") private val firstUnit: Double, - @JsonProperty("last_unit") private val lastUnit: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("last_unit") private val lastUnit: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), @@ -28042,15 +30946,15 @@ constructor( /** Inclusive tier starting value */ @JsonProperty("first_unit") fun firstUnit(): Double = firstUnit + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** * Exclusive tier ending value. If null, this is treated as the last tier */ @JsonProperty("last_unit") fun lastUnit(): Optional = Optional.ofNullable(lastUnit) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -28065,32 +30969,48 @@ constructor( class Builder { private var firstUnit: Double? = null - private var lastUnit: Double? = null private var unitAmount: String? = null + private var lastUnit: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } /** Inclusive tier starting value */ fun firstUnit(firstUnit: Double) = apply { this.firstUnit = firstUnit } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + /** * Exclusive tier ending value. If null, this is treated as the last * tier */ - fun lastUnit(lastUnit: Double) = apply { this.lastUnit = lastUnit } + fun lastUnit(lastUnit: Double?) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { @@ -28119,10 +31039,10 @@ constructor( checkNotNull(firstUnit) { "`firstUnit` is required but was not set" }, - lastUnit, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + lastUnit, additionalProperties.toImmutable(), ) } @@ -28132,17 +31052,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -28573,60 +31493,59 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredConfig == other.tieredConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredConfig=$tieredConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_bps_config") + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -28634,9 +31553,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -28644,6 +31560,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -28655,17 +31594,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -28674,21 +31602,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_bps_config") - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -28710,21 +31630,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredBpsConfig: TieredBpsConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredBpsConfig: TieredBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -28732,118 +31652,212 @@ constructor( internal fun from( newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice ) = apply { - metadata = newSubscriptionTieredBpsPrice.metadata - externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + cadence = newSubscriptionTieredBpsPrice.cadence + itemId = newSubscriptionTieredBpsPrice.itemId + modelType = newSubscriptionTieredBpsPrice.modelType name = newSubscriptionTieredBpsPrice.name + tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - itemId = newSubscriptionTieredBpsPrice.itemId billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey - cadence = newSubscriptionTieredBpsPrice.cadence billingCycleConfiguration = newSubscriptionTieredBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredBpsPrice.conversionRate - modelType = newSubscriptionTieredBpsPrice.modelType - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig currency = newSubscriptionTieredBpsPrice.currency + externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredBpsPrice.metadata referenceId = newSubscriptionTieredBpsPrice.referenceId additionalProperties = newSubscriptionTieredBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { + this.tieredBpsConfig = tieredBpsConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { - this.tieredBpsConfig = tieredBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -28869,23 +31883,23 @@ constructor( fun build(): NewSubscriptionTieredBpsPrice = NewSubscriptionTieredBpsPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredBpsConfig) { "`tieredBpsConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -29112,15 +32126,18 @@ constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") private val bps: Double, @JsonProperty("minimum_amount") private val minimumAmount: String, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("bps") private val bps: Double, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + @JsonProperty("bps") fun bps(): Double = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount @@ -29128,9 +32145,6 @@ constructor( @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Per-event basis point rate */ - @JsonProperty("bps") fun bps(): Double = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -29148,40 +32162,48 @@ constructor( class Builder { + private var bps: Double? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var bps: Double? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -29206,11 +32228,11 @@ constructor( fun build(): Tier = Tier( + checkNotNull(bps) { "`bps` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, maximumAmount, - checkNotNull(bps) { "`bps` is required but was not set" }, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -29221,17 +32243,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -29662,56 +32684,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredBpsConfig == other.tieredBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredBpsConfig=$tieredBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredBpsPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bps_config") private val bpsConfig: BpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bps_config") private val bpsConfig: BpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -29723,9 +32743,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -29733,6 +32750,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -29744,17 +32784,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -29763,20 +32792,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -29798,59 +32820,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bpsConfig: BpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bpsConfig: BpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - metadata = newSubscriptionBpsPrice.metadata - externalPriceId = newSubscriptionBpsPrice.externalPriceId + bpsConfig = newSubscriptionBpsPrice.bpsConfig + cadence = newSubscriptionBpsPrice.cadence + itemId = newSubscriptionBpsPrice.itemId + modelType = newSubscriptionBpsPrice.modelType name = newSubscriptionBpsPrice.name billableMetricId = newSubscriptionBpsPrice.billableMetricId - itemId = newSubscriptionBpsPrice.itemId billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBpsPrice.cadence billingCycleConfiguration = newSubscriptionBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBpsPrice.conversionRate - modelType = newSubscriptionBpsPrice.modelType - bpsConfig = newSubscriptionBpsPrice.bpsConfig currency = newSubscriptionBpsPrice.currency + externalPriceId = newSubscriptionBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBpsPrice.metadata referenceId = newSubscriptionBpsPrice.referenceId additionalProperties = newSubscriptionBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -29859,75 +32879,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -29953,21 +33069,21 @@ constructor( fun build(): NewSubscriptionBpsPrice = NewSubscriptionBpsPrice( - metadata, - externalPriceId, + checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -30019,10 +33135,14 @@ constructor( fun bps(bps: Double) = apply { this.bps = bps } /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -30615,56 +33735,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bpsConfig == other.bpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bpsConfig=$bpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -30676,9 +33794,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -30686,6 +33801,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -30697,17 +33835,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -30716,20 +33843,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -30751,61 +33871,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkBpsConfig: BulkBpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkBpsConfig: BulkBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = apply { - metadata = newSubscriptionBulkBpsPrice.metadata - externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig + cadence = newSubscriptionBulkBpsPrice.cadence + itemId = newSubscriptionBulkBpsPrice.itemId + modelType = newSubscriptionBulkBpsPrice.modelType name = newSubscriptionBulkBpsPrice.name billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - itemId = newSubscriptionBulkBpsPrice.itemId billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBulkBpsPrice.cadence billingCycleConfiguration = newSubscriptionBulkBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkBpsPrice.conversionRate - modelType = newSubscriptionBulkBpsPrice.modelType - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig currency = newSubscriptionBulkBpsPrice.currency + externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkBpsPrice.metadata referenceId = newSubscriptionBulkBpsPrice.referenceId additionalProperties = newSubscriptionBulkBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { + this.bulkBpsConfig = bulkBpsConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -30813,77 +33933,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { - this.bulkBpsConfig = bulkBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -30909,23 +34123,23 @@ constructor( fun build(): NewSubscriptionBulkBpsPrice = NewSubscriptionBulkBpsPrice( - metadata, - externalPriceId, + checkNotNull(bulkBpsConfig) { + "`bulkBpsConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkBpsConfig) { - "`bulkBpsConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -31017,21 +34231,21 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("bps") private val bps: Double, + @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + @JsonProperty("bps") fun bps(): Double = bps + /** Upper bound for tier */ @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Basis points to rate on */ - @JsonProperty("bps") fun bps(): Double = bps - /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -31049,33 +34263,41 @@ constructor( class Builder { - private var maximumAmount: String? = null private var bps: Double? = null + private var maximumAmount: String? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -31100,8 +34322,8 @@ constructor( fun build(): Tier = Tier( - maximumAmount, checkNotNull(bps) { "`bps` is required but was not set" }, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -31112,17 +34334,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -31687,56 +34909,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkBpsConfig == other.bulkBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkBpsConfig=$bulkBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -31748,9 +34968,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -31758,6 +34975,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -31769,17 +35009,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -31788,20 +35017,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -31823,59 +35045,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkConfig: BulkConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkConfig: BulkConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - metadata = newSubscriptionBulkPrice.metadata - externalPriceId = newSubscriptionBulkPrice.externalPriceId + bulkConfig = newSubscriptionBulkPrice.bulkConfig + cadence = newSubscriptionBulkPrice.cadence + itemId = newSubscriptionBulkPrice.itemId + modelType = newSubscriptionBulkPrice.modelType name = newSubscriptionBulkPrice.name billableMetricId = newSubscriptionBulkPrice.billableMetricId - itemId = newSubscriptionBulkPrice.itemId billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey - cadence = newSubscriptionBulkPrice.cadence billingCycleConfiguration = newSubscriptionBulkPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkPrice.conversionRate - modelType = newSubscriptionBulkPrice.modelType - bulkConfig = newSubscriptionBulkPrice.bulkConfig currency = newSubscriptionBulkPrice.currency + externalPriceId = newSubscriptionBulkPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkPrice.metadata referenceId = newSubscriptionBulkPrice.referenceId additionalProperties = newSubscriptionBulkPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -31884,75 +35104,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -31978,21 +35294,21 @@ constructor( fun build(): NewSubscriptionBulkPrice = NewSubscriptionBulkPrice( - metadata, - externalPriceId, + checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -32075,20 +35391,20 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Upper bound for this tier */ @JsonProperty("maximum_units") fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -32102,28 +35418,39 @@ constructor( class Builder { - private var maximumUnits: Double? = null private var unitAmount: String? = null + private var maximumUnits: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = apply { - this.maximumUnits = maximumUnits - } - /** Amount per unit */ fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double?) = apply { + this.maximumUnits = maximumUnits + } + + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(maximumUnits as Double?) + + /** Upper bound for this tier */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -32148,10 +35475,10 @@ constructor( fun build(): Tier = Tier( - maximumUnits, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -32161,17 +35488,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -32736,61 +36063,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkConfig == other.bulkConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkConfig=$bulkConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("threshold_total_amount_config") + private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("threshold_total_amount_config") - private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("threshold_total_amount_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -32798,9 +36125,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -32808,6 +36132,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -32819,17 +36166,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -32838,22 +36174,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("threshold_total_amount_config") - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -32875,21 +36202,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -32898,122 +36225,216 @@ constructor( newSubscriptionThresholdTotalAmountPrice: NewSubscriptionThresholdTotalAmountPrice ) = apply { - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId + cadence = newSubscriptionThresholdTotalAmountPrice.cadence + itemId = newSubscriptionThresholdTotalAmountPrice.itemId + modelType = newSubscriptionThresholdTotalAmountPrice.modelType name = newSubscriptionThresholdTotalAmountPrice.name + thresholdTotalAmountConfig = + newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - itemId = newSubscriptionThresholdTotalAmountPrice.itemId billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration + conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate + currency = newSubscriptionThresholdTotalAmountPrice.currency + externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId fixedPriceQuantity = newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - currency = newSubscriptionThresholdTotalAmountPrice.currency + metadata = newSubscriptionThresholdTotalAmountPrice.metadata referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId additionalProperties = newSubscriptionThresholdTotalAmountPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: ThresholdTotalAmountConfig + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: ThresholdTotalAmountConfig - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -33039,23 +36460,23 @@ constructor( fun build(): NewSubscriptionThresholdTotalAmountPrice = NewSubscriptionThresholdTotalAmountPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(thresholdTotalAmountConfig) { "`thresholdTotalAmountConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -33680,61 +37101,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, thresholdTotalAmountConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionThresholdTotalAmountPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionThresholdTotalAmountPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_config") + private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_config") - private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_config") + fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -33742,9 +37162,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -33752,6 +37169,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -33763,17 +37203,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -33782,21 +37211,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_config") - fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -33818,21 +37239,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageConfig: TieredPackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageConfig: TieredPackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -33840,118 +37261,212 @@ constructor( internal fun from( newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice ) = apply { - metadata = newSubscriptionTieredPackagePrice.metadata - externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + cadence = newSubscriptionTieredPackagePrice.cadence + itemId = newSubscriptionTieredPackagePrice.itemId + modelType = newSubscriptionTieredPackagePrice.modelType name = newSubscriptionTieredPackagePrice.name + tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - itemId = newSubscriptionTieredPackagePrice.itemId billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey - cadence = newSubscriptionTieredPackagePrice.cadence billingCycleConfiguration = newSubscriptionTieredPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPackagePrice.conversionRate - modelType = newSubscriptionTieredPackagePrice.modelType - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig currency = newSubscriptionTieredPackagePrice.currency + externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPackagePrice.metadata referenceId = newSubscriptionTieredPackagePrice.referenceId additionalProperties = newSubscriptionTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { + this.tieredPackageConfig = tieredPackageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { - this.tieredPackageConfig = tieredPackageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -33977,23 +37492,23 @@ constructor( fun build(): NewSubscriptionTieredPackagePrice = NewSubscriptionTieredPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredPackageConfig) { "`tieredPackageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -34617,61 +38132,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageConfig == other.tieredPackageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageConfig=$tieredPackageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_minimum_config") + private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_minimum_config") - private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_minimum_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -34679,9 +38193,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -34689,6 +38200,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -34700,17 +38234,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -34719,21 +38242,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_minimum_config") - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -34755,21 +38270,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -34777,123 +38292,217 @@ constructor( internal fun from( newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice ) = apply { - metadata = newSubscriptionTieredWithMinimumPrice.metadata - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId + cadence = newSubscriptionTieredWithMinimumPrice.cadence + itemId = newSubscriptionTieredWithMinimumPrice.itemId + modelType = newSubscriptionTieredWithMinimumPrice.modelType name = newSubscriptionTieredWithMinimumPrice.name + tieredWithMinimumConfig = + newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - itemId = newSubscriptionTieredWithMinimumPrice.itemId billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration + conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate + currency = newSubscriptionTieredWithMinimumPrice.currency + externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionTieredWithMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - modelType = newSubscriptionTieredWithMinimumPrice.modelType - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - currency = newSubscriptionTieredWithMinimumPrice.currency + metadata = newSubscriptionTieredWithMinimumPrice.metadata referenceId = newSubscriptionTieredWithMinimumPrice.referenceId additionalProperties = newSubscriptionTieredWithMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + apply { + this.tieredWithMinimumConfig = tieredWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - apply { - this.tieredWithMinimumConfig = tieredWithMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -34919,23 +38528,23 @@ constructor( fun build(): NewSubscriptionTieredWithMinimumPrice = NewSubscriptionTieredWithMinimumPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithMinimumConfig) { "`tieredWithMinimumConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -35560,61 +39169,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithMinimumConfig=$tieredWithMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithPercentPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_percent_config") + private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_percent_config") - private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_percent_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -35622,9 +39230,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -35632,6 +39237,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -35643,17 +39271,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -35662,21 +39279,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_percent_config") - fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -35698,21 +39307,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithPercentConfig: UnitWithPercentConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithPercentConfig: UnitWithPercentConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -35720,120 +39329,214 @@ constructor( internal fun from( newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice ) = apply { - metadata = newSubscriptionUnitWithPercentPrice.metadata - externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + cadence = newSubscriptionUnitWithPercentPrice.cadence + itemId = newSubscriptionUnitWithPercentPrice.itemId + modelType = newSubscriptionUnitWithPercentPrice.modelType name = newSubscriptionUnitWithPercentPrice.name + unitWithPercentConfig = + newSubscriptionUnitWithPercentPrice.unitWithPercentConfig billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - itemId = newSubscriptionUnitWithPercentPrice.itemId billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithPercentPrice.cadence billingCycleConfiguration = newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - modelType = newSubscriptionUnitWithPercentPrice.modelType - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig currency = newSubscriptionUnitWithPercentPrice.currency + externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitWithPercentPrice.metadata referenceId = newSubscriptionUnitWithPercentPrice.referenceId additionalProperties = newSubscriptionUnitWithPercentPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = + apply { + this.unitWithPercentConfig = unitWithPercentConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = - apply { - this.unitWithPercentConfig = unitWithPercentConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -35859,23 +39562,23 @@ constructor( fun build(): NewSubscriptionUnitWithPercentPrice = NewSubscriptionUnitWithPercentPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithPercentConfig) { "`unitWithPercentConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -36499,61 +40202,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithPercentConfig == other.unitWithPercentConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithPercentConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithPercentPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithPercentConfig=$unitWithPercentConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithPercentPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_with_allocation_config") + private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_with_allocation_config") - private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_with_allocation_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -36561,9 +40264,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -36571,6 +40271,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -36582,17 +40305,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -36601,22 +40313,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_with_allocation_config") - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -36638,21 +40341,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -36661,123 +40364,217 @@ constructor( newSubscriptionPackageWithAllocationPrice: NewSubscriptionPackageWithAllocationPrice ) = apply { - metadata = newSubscriptionPackageWithAllocationPrice.metadata - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId + cadence = newSubscriptionPackageWithAllocationPrice.cadence + itemId = newSubscriptionPackageWithAllocationPrice.itemId + modelType = newSubscriptionPackageWithAllocationPrice.modelType name = newSubscriptionPackageWithAllocationPrice.name + packageWithAllocationConfig = + newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig billableMetricId = newSubscriptionPackageWithAllocationPrice.billableMetricId - itemId = newSubscriptionPackageWithAllocationPrice.itemId billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate + currency = newSubscriptionPackageWithAllocationPrice.currency + externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionPackageWithAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - modelType = newSubscriptionPackageWithAllocationPrice.modelType - packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - currency = newSubscriptionPackageWithAllocationPrice.currency + metadata = newSubscriptionPackageWithAllocationPrice.metadata referenceId = newSubscriptionPackageWithAllocationPrice.referenceId additionalProperties = newSubscriptionPackageWithAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -36803,23 +40600,23 @@ constructor( fun build(): NewSubscriptionPackageWithAllocationPrice = NewSubscriptionPackageWithAllocationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageWithAllocationConfig) { "`packageWithAllocationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -37445,61 +41242,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageWithAllocationConfig == other.packageWithAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageWithAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackageWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageWithAllocationConfig=$packageWithAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackageWithAllocationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTierWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_proration_config") + private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_proration_config") - private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_proration_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -37507,9 +41304,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -37517,6 +41311,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -37528,17 +41345,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -37547,22 +41353,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_proration_config") - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -37584,21 +41381,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -37606,122 +41403,216 @@ constructor( internal fun from( newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice ) = apply { - metadata = newSubscriptionTierWithProrationPrice.metadata - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId + cadence = newSubscriptionTierWithProrationPrice.cadence + itemId = newSubscriptionTierWithProrationPrice.itemId + modelType = newSubscriptionTierWithProrationPrice.modelType name = newSubscriptionTierWithProrationPrice.name + tieredWithProrationConfig = + newSubscriptionTierWithProrationPrice.tieredWithProrationConfig billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - itemId = newSubscriptionTierWithProrationPrice.itemId billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTierWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionTierWithProrationPrice.conversionRate + currency = newSubscriptionTierWithProrationPrice.currency + externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionTierWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTierWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionTierWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - modelType = newSubscriptionTierWithProrationPrice.modelType - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - currency = newSubscriptionTierWithProrationPrice.currency + metadata = newSubscriptionTierWithProrationPrice.metadata referenceId = newSubscriptionTierWithProrationPrice.referenceId additionalProperties = newSubscriptionTierWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithProrationConfig( + tieredWithProrationConfig: TieredWithProrationConfig + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredWithProrationConfig( - tieredWithProrationConfig: TieredWithProrationConfig - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -37747,23 +41638,23 @@ constructor( fun build(): NewSubscriptionTierWithProrationPrice = NewSubscriptionTierWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithProrationConfig) { "`tieredWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -38388,61 +42279,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithProrationConfig == other.tieredWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTierWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithProrationConfig=$tieredWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTierWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_proration_config") + private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_proration_config") - private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -38450,9 +42340,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -38460,6 +42347,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -38471,17 +42381,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -38490,21 +42389,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_proration_config") - fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -38526,21 +42417,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithProrationConfig: UnitWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithProrationConfig: UnitWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -38548,123 +42439,217 @@ constructor( internal fun from( newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice ) = apply { - metadata = newSubscriptionUnitWithProrationPrice.metadata - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId + cadence = newSubscriptionUnitWithProrationPrice.cadence + itemId = newSubscriptionUnitWithProrationPrice.itemId + modelType = newSubscriptionUnitWithProrationPrice.modelType name = newSubscriptionUnitWithProrationPrice.name + unitWithProrationConfig = + newSubscriptionUnitWithProrationPrice.unitWithProrationConfig billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - itemId = newSubscriptionUnitWithProrationPrice.itemId billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionUnitWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate + currency = newSubscriptionUnitWithProrationPrice.currency + externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionUnitWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - modelType = newSubscriptionUnitWithProrationPrice.modelType - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - currency = newSubscriptionUnitWithProrationPrice.currency + metadata = newSubscriptionUnitWithProrationPrice.metadata referenceId = newSubscriptionUnitWithProrationPrice.referenceId additionalProperties = newSubscriptionUnitWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + apply { + this.unitWithProrationConfig = unitWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - apply { - this.unitWithProrationConfig = unitWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -38690,23 +42675,23 @@ constructor( fun build(): NewSubscriptionUnitWithProrationPrice = NewSubscriptionUnitWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithProrationConfig) { "`unitWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -39331,57 +43316,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithProrationConfig == other.unitWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithProrationConfig=$unitWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_allocation_config") + private val groupedAllocationConfig: GroupedAllocationConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_allocation_config") - private val groupedAllocationConfig: GroupedAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_allocation_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -39393,9 +43377,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -39403,6 +43384,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -39414,17 +43418,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -39433,21 +43426,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_allocation_config") - fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -39469,21 +43454,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedAllocationConfig: GroupedAllocationConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedAllocationConfig: GroupedAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -39491,43 +43476,44 @@ constructor( internal fun from( newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice ) = apply { - metadata = newSubscriptionGroupedAllocationPrice.metadata - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId + cadence = newSubscriptionGroupedAllocationPrice.cadence + groupedAllocationConfig = + newSubscriptionGroupedAllocationPrice.groupedAllocationConfig + itemId = newSubscriptionGroupedAllocationPrice.itemId + modelType = newSubscriptionGroupedAllocationPrice.modelType name = newSubscriptionGroupedAllocationPrice.name billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - itemId = newSubscriptionGroupedAllocationPrice.itemId billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate + currency = newSubscriptionGroupedAllocationPrice.currency + externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - modelType = newSubscriptionGroupedAllocationPrice.modelType - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - currency = newSubscriptionGroupedAllocationPrice.currency + metadata = newSubscriptionGroupedAllocationPrice.metadata referenceId = newSubscriptionGroupedAllocationPrice.referenceId additionalProperties = newSubscriptionGroupedAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + apply { + this.groupedAllocationConfig = groupedAllocationConfig + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -39536,78 +43522,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - apply { - this.groupedAllocationConfig = groupedAllocationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -39633,23 +43712,23 @@ constructor( fun build(): NewSubscriptionGroupedAllocationPrice = NewSubscriptionGroupedAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedAllocationConfig) { + "`groupedAllocationConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedAllocationConfig) { - "`groupedAllocationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -40274,57 +44353,57 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedAllocationConfig == other.groupedAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && cadence == other.cadence && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedAllocationConfig=$groupedAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedAllocationPrice{cadence=$cadence, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_with_prorated_minimum_config") + private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_prorated_minimum_config") - private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_with_prorated_minimum_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -40336,9 +44415,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -40346,6 +44422,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -40357,17 +44456,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -40376,22 +44464,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_prorated_minimum_config") - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -40413,23 +44492,23 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedWithProratedMinimumConfig: + GroupedWithProratedMinimumConfig? = + null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithProratedMinimumConfig: - GroupedWithProratedMinimumConfig? = - null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -40438,50 +44517,52 @@ constructor( newSubscriptionGroupedWithProratedMinimumPrice: NewSubscriptionGroupedWithProratedMinimumPrice ) = apply { - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId + cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence + groupedWithProratedMinimumConfig = + newSubscriptionGroupedWithProratedMinimumPrice + .groupedWithProratedMinimumConfig + itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId + modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType name = newSubscriptionGroupedWithProratedMinimumPrice.name billableMetricId = newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId billedInAdvance = newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration + conversionRate = + newSubscriptionGroupedWithProratedMinimumPrice.conversionRate + currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + externalPriceId = + newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedWithProratedMinimumPrice .invoicingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId additionalProperties = newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -40489,79 +44570,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { - this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -40587,23 +44760,23 @@ constructor( fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = NewSubscriptionGroupedWithProratedMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedWithProratedMinimumConfig) { + "`groupedWithProratedMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithProratedMinimumConfig) { - "`groupedWithProratedMinimumConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -41230,57 +45403,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && cadence == other.cadence && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithProratedMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithProratedMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedWithProratedMinimumPrice{cadence=$cadence, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_with_proration_config") + private val bulkWithProrationConfig: BulkWithProrationConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_with_proration_config") - private val bulkWithProrationConfig: BulkWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_with_proration_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -41292,9 +45464,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -41302,6 +45471,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -41313,17 +45505,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -41332,21 +45513,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_with_proration_config") - fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -41368,21 +45541,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkWithProrationConfig: BulkWithProrationConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkWithProrationConfig: BulkWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -41390,43 +45563,44 @@ constructor( internal fun from( newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice ) = apply { - metadata = newSubscriptionBulkWithProrationPrice.metadata - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId + bulkWithProrationConfig = + newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig + cadence = newSubscriptionBulkWithProrationPrice.cadence + itemId = newSubscriptionBulkWithProrationPrice.itemId + modelType = newSubscriptionBulkWithProrationPrice.modelType name = newSubscriptionBulkWithProrationPrice.name billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - itemId = newSubscriptionBulkWithProrationPrice.itemId billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionBulkWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate + currency = newSubscriptionBulkWithProrationPrice.currency + externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionBulkWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionBulkWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - modelType = newSubscriptionBulkWithProrationPrice.modelType - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - currency = newSubscriptionBulkWithProrationPrice.currency + metadata = newSubscriptionBulkWithProrationPrice.metadata referenceId = newSubscriptionBulkWithProrationPrice.referenceId additionalProperties = newSubscriptionBulkWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + apply { + this.bulkWithProrationConfig = bulkWithProrationConfig + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -41435,78 +45609,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - apply { - this.bulkWithProrationConfig = bulkWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -41532,23 +45799,23 @@ constructor( fun build(): NewSubscriptionBulkWithProrationPrice = NewSubscriptionBulkWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(bulkWithProrationConfig) { + "`bulkWithProrationConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkWithProrationConfig) { - "`bulkWithProrationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -42173,17 +46440,17 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkWithProrationConfig == other.bulkWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } @@ -42192,17 +46459,17 @@ constructor( return true } - return /* spotless:off */ other is ReplacePrice && priceId == other.priceId && externalPriceId == other.externalPriceId && price == other.price && fixedPriceQuantity == other.fixedPriceQuantity && replacesPriceId == other.replacesPriceId && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && discounts == other.discounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ReplacePrice && replacesPriceId == other.replacesPriceId && discounts == other.discounts && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, externalPriceId, price, fixedPriceQuantity, replacesPriceId, minimumAmount, maximumAmount, discounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(replacesPriceId, discounts, externalPriceId, fixedPriceQuantity, maximumAmount, minimumAmount, price, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ReplacePrice{priceId=$priceId, externalPriceId=$externalPriceId, price=$price, fixedPriceQuantity=$fixedPriceQuantity, replacesPriceId=$replacesPriceId, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, discounts=$discounts, additionalProperties=$additionalProperties}" + "ReplacePrice{replacesPriceId=$replacesPriceId, discounts=$discounts, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt index 864e6329..9172a8a2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionCreateResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionCreateResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,83 +419,168 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionCreateResponse: SubscriptionCreateResponse) = apply { - metadata = subscriptionCreateResponse.metadata id = subscriptionCreateResponse.id - customer = subscriptionCreateResponse.customer - plan = subscriptionCreateResponse.plan - startDate = subscriptionCreateResponse.startDate - endDate = subscriptionCreateResponse.endDate - createdAt = subscriptionCreateResponse.createdAt - currentBillingPeriodStartDate = subscriptionCreateResponse.currentBillingPeriodStartDate - currentBillingPeriodEndDate = subscriptionCreateResponse.currentBillingPeriodEndDate - status = subscriptionCreateResponse.status - trialInfo = subscriptionCreateResponse.trialInfo activePlanPhaseOrder = subscriptionCreateResponse.activePlanPhaseOrder - fixedFeeQuantitySchedule = subscriptionCreateResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionCreateResponse.defaultInvoiceMemo + adjustmentIntervals = subscriptionCreateResponse.adjustmentIntervals autoCollection = subscriptionCreateResponse.autoCollection - netTerms = subscriptionCreateResponse.netTerms - redeemedCoupon = subscriptionCreateResponse.redeemedCoupon - billingCycleDay = subscriptionCreateResponse.billingCycleDay billingCycleAnchorConfiguration = subscriptionCreateResponse.billingCycleAnchorConfiguration - invoicingThreshold = subscriptionCreateResponse.invoicingThreshold - priceIntervals = subscriptionCreateResponse.priceIntervals - adjustmentIntervals = subscriptionCreateResponse.adjustmentIntervals + billingCycleDay = subscriptionCreateResponse.billingCycleDay + createdAt = subscriptionCreateResponse.createdAt + currentBillingPeriodEndDate = subscriptionCreateResponse.currentBillingPeriodEndDate + currentBillingPeriodStartDate = subscriptionCreateResponse.currentBillingPeriodStartDate + customer = subscriptionCreateResponse.customer + defaultInvoiceMemo = subscriptionCreateResponse.defaultInvoiceMemo discountIntervals = subscriptionCreateResponse.discountIntervals - minimumIntervals = subscriptionCreateResponse.minimumIntervals + endDate = subscriptionCreateResponse.endDate + fixedFeeQuantitySchedule = subscriptionCreateResponse.fixedFeeQuantitySchedule + invoicingThreshold = subscriptionCreateResponse.invoicingThreshold maximumIntervals = subscriptionCreateResponse.maximumIntervals + metadata = subscriptionCreateResponse.metadata + minimumIntervals = subscriptionCreateResponse.minimumIntervals + netTerms = subscriptionCreateResponse.netTerms + plan = subscriptionCreateResponse.plan + priceIntervals = subscriptionCreateResponse.priceIntervals + redeemedCoupon = subscriptionCreateResponse.redeemedCoupon + startDate = subscriptionCreateResponse.startDate + status = subscriptionCreateResponse.status + trialInfo = subscriptionCreateResponse.trialInfo additionalProperties = subscriptionCreateResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -532,94 +617,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -628,35 +659,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -673,45 +712,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -722,41 +737,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -779,31 +779,31 @@ private constructor( fun build(): SubscriptionCreateResponse = SubscriptionCreateResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -816,15 +816,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -833,32 +833,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -869,9 +869,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -887,18 +887,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -912,20 +912,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -936,6 +922,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -959,9 +959,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1215,30 +1215,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1249,22 +1261,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1279,26 +1296,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1308,12 +1308,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1328,23 +1328,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1353,6 +1353,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1377,43 +1408,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1439,12 +1439,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1506,17 +1506,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1526,48 +1526,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1576,32 +1569,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1611,6 +1603,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1620,12 +1620,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1640,24 +1640,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1666,28 +1666,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1699,17 +1682,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1727,6 +1712,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1752,12 +1752,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1819,17 +1819,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1839,21 +1839,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1863,6 +1863,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1873,15 +1879,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1890,6 +1890,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1903,18 +1912,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1930,11 +1930,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1950,22 +1950,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1975,6 +1975,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1999,28 +2015,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2061,11 +2061,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2128,17 +2128,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2148,51 +2148,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2200,35 +2196,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2236,8 +2231,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2248,13 +2248,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2269,25 +2269,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2295,6 +2295,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2310,36 +2326,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2356,11 +2347,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2387,13 +2387,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2455,17 +2455,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2475,56 +2475,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2534,29 +2543,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2566,12 +2566,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2586,23 +2586,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2610,28 +2610,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2643,17 +2626,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2671,6 +2656,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2696,12 +2696,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2763,17 +2763,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2782,17 +2782,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3157,40 +3157,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3199,16 +3190,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3220,6 +3212,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3228,12 +3228,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3247,33 +3247,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3283,20 +3276,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3316,6 +3295,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3340,12 +3340,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3406,57 +3406,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3465,18 +3453,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3488,6 +3475,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3496,12 +3496,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3515,52 +3515,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3569,24 +3567,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3612,12 +3612,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3678,60 +3678,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3740,19 +3725,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3764,6 +3750,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3772,12 +3772,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3791,25 +3791,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3817,6 +3836,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3832,39 +3865,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3889,12 +3889,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3955,17 +3955,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3973,39 +3973,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4014,10 +4014,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4031,39 +4031,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4085,10 +4085,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4098,49 +4098,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4149,6 +4142,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4156,10 +4153,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4171,12 +4165,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4185,11 +4185,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4203,37 +4203,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4253,6 +4239,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4267,6 +4259,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4288,11 +4288,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4302,17 +4302,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4399,32 +4399,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4433,6 +4426,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4440,10 +4437,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4455,12 +4449,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4469,11 +4469,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4487,37 +4487,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4537,6 +4523,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4551,6 +4543,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4572,11 +4572,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4586,17 +4586,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4608,39 +4608,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4649,6 +4666,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4879,51 +4905,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5155,34 +5178,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5193,13 +5193,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5214,26 +5214,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5241,19 +5241,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5267,6 +5296,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5727,64 +5772,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5808,13 +5808,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5823,12 +5823,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5836,16 +5836,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5856,8 +5856,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5872,24 +5872,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5897,6 +5893,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5925,8 +5925,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5937,17 +5937,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5955,17 +5955,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5975,29 +5975,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6007,8 +6007,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6023,15 +6023,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6039,16 +6039,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6071,8 +6071,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6082,17 +6082,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6254,15 +6254,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionCreateResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionCreateResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionCreateResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionCreateResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt index 5f9c9537..0b39fcbf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt @@ -109,22 +109,40 @@ constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } /** The currency or custom pricing unit to use. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String?) = apply { this.currency = currency } + + /** The currency or custom pricing unit to use. */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** 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: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: Optional) = + timeframeEnd(timeframeEnd.orElse(null)) /** Costs returned are inclusive of `timeframe_start`. */ - fun timeframeStart(timeframeStart: OffsetDateTime) = apply { + fun timeframeStart(timeframeStart: OffsetDateTime?) = apply { this.timeframeStart = timeframeStart } + /** Costs returned are inclusive of `timeframe_start`. */ + fun timeframeStart(timeframeStart: Optional) = + timeframeStart(timeframeStart.orElse(null)) + + /** + * Controls whether Orb returns cumulative costs since the start of the billing period, or + * 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: ViewMode?) = apply { this.viewMode = viewMode } + /** * Controls whether Orb returns cumulative costs since the start of the billing period, or * 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: ViewMode) = apply { this.viewMode = viewMode } + fun viewMode(viewMode: Optional) = viewMode(viewMode.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt index 50536cd2..0c968d8a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsResponse.kt @@ -97,48 +97,48 @@ private constructor( class Data @JsonCreator private constructor( + @JsonProperty("per_price_costs") + @ExcludeMissing + private val perPriceCosts: JsonField> = JsonMissing.of(), @JsonProperty("subtotal") @ExcludeMissing private val subtotal: JsonField = JsonMissing.of(), - @JsonProperty("total") + @JsonProperty("timeframe_end") @ExcludeMissing - private val total: JsonField = JsonMissing.of(), + private val timeframeEnd: JsonField = JsonMissing.of(), @JsonProperty("timeframe_start") @ExcludeMissing private val timeframeStart: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_end") - @ExcludeMissing - private val timeframeEnd: JsonField = JsonMissing.of(), - @JsonProperty("per_price_costs") + @JsonProperty("total") @ExcludeMissing - private val perPriceCosts: JsonField> = JsonMissing.of(), + private val total: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun perPriceCosts(): List = perPriceCosts.getRequired("per_price_costs") + /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(): String = subtotal.getRequired("subtotal") - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(): String = total.getRequired("total") + fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(): String = total.getRequired("total") - fun perPriceCosts(): List = perPriceCosts.getRequired("per_price_costs") + @JsonProperty("per_price_costs") @ExcludeMissing fun _perPriceCosts() = perPriceCosts /** Total costs for the timeframe, excluding any minimums and discounts. */ @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal - /** Total costs for the timeframe, including any minimums and discounts. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - - @JsonProperty("per_price_costs") @ExcludeMissing fun _perPriceCosts() = perPriceCosts + /** Total costs for the timeframe, including any minimums and discounts. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total @JsonAnyGetter @ExcludeMissing @@ -148,11 +148,11 @@ private constructor( fun validate(): Data = apply { if (!validated) { + perPriceCosts().forEach { it.validate() } subtotal() - total() - timeframeStart() timeframeEnd() - perPriceCosts().forEach { it.validate() } + timeframeStart() + total() validated = true } } @@ -166,34 +166,42 @@ private constructor( class Builder { + private var perPriceCosts: JsonField> = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() - private var total: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() private var timeframeEnd: JsonField = JsonMissing.of() - private var perPriceCosts: JsonField> = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { + perPriceCosts = data.perPriceCosts subtotal = data.subtotal - total = data.total - timeframeStart = data.timeframeStart timeframeEnd = data.timeframeEnd - perPriceCosts = data.perPriceCosts + timeframeStart = data.timeframeStart + total = data.total additionalProperties = data.additionalProperties.toMutableMap() } + fun perPriceCosts(perPriceCosts: List) = + perPriceCosts(JsonField.of(perPriceCosts)) + + fun perPriceCosts(perPriceCosts: JsonField>) = apply { + this.perPriceCosts = perPriceCosts + } + /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) /** Total costs for the timeframe, excluding any minimums and discounts. */ fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(total: String) = total(JsonField.of(total)) + fun timeframeEnd(timeframeEnd: OffsetDateTime) = + timeframeEnd(JsonField.of(timeframeEnd)) - /** Total costs for the timeframe, including any minimums and discounts. */ - fun total(total: JsonField) = apply { this.total = total } + fun timeframeEnd(timeframeEnd: JsonField) = apply { + this.timeframeEnd = timeframeEnd + } fun timeframeStart(timeframeStart: OffsetDateTime) = timeframeStart(JsonField.of(timeframeStart)) @@ -202,19 +210,11 @@ private constructor( this.timeframeStart = timeframeStart } - fun timeframeEnd(timeframeEnd: OffsetDateTime) = - timeframeEnd(JsonField.of(timeframeEnd)) - - fun timeframeEnd(timeframeEnd: JsonField) = apply { - this.timeframeEnd = timeframeEnd - } - - fun perPriceCosts(perPriceCosts: List) = - perPriceCosts(JsonField.of(perPriceCosts)) + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(total: String) = total(JsonField.of(total)) - fun perPriceCosts(perPriceCosts: JsonField>) = apply { - this.perPriceCosts = perPriceCosts - } + /** Total costs for the timeframe, including any minimums and discounts. */ + fun total(total: JsonField) = apply { this.total = total } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -237,11 +237,11 @@ private constructor( fun build(): Data = Data( + perPriceCosts.map { it.toImmutable() }, subtotal, - total, - timeframeStart, timeframeEnd, - perPriceCosts.map { it.toImmutable() }, + timeframeStart, + total, additionalProperties.toImmutable(), ) } @@ -250,31 +250,22 @@ private constructor( class PerPriceCost @JsonCreator private constructor( - @JsonProperty("quantity") + @JsonProperty("price") @ExcludeMissing - private val quantity: JsonField = JsonMissing.of(), + private val price: JsonField = JsonMissing.of(), @JsonProperty("subtotal") @ExcludeMissing private val subtotal: JsonField = JsonMissing.of(), @JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(), - @JsonProperty("price") + @JsonProperty("quantity") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), + private val quantity: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The price's quantity for the timeframe */ - fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) - - /** Price's contributions for the timeframe, excluding any minimums and discounts. */ - fun subtotal(): String = subtotal.getRequired("subtotal") - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(): String = total.getRequired("total") - /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -505,14 +496,14 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The price's quantity for the timeframe */ - @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity - /** Price's contributions for the timeframe, excluding any minimums and discounts. */ - @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + fun subtotal(): String = subtotal.getRequired("subtotal") /** Price's contributions for the timeframe, including minimums and discounts. */ - @JsonProperty("total") @ExcludeMissing fun _total() = total + fun total(): String = total.getRequired("total") + + /** The price's quantity for the timeframe */ + fun quantity(): Optional = Optional.ofNullable(quantity.getNullable("quantity")) /** * The Price resource represents a price that can be billed on a subscription, resulting @@ -744,6 +735,15 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price + /** Price's contributions for the timeframe, excluding any minimums and discounts. */ + @JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal + + /** Price's contributions for the timeframe, including minimums and discounts. */ + @JsonProperty("total") @ExcludeMissing fun _total() = total + + /** The price's quantity for the timeframe */ + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -752,10 +752,10 @@ private constructor( fun validate(): PerPriceCost = apply { if (!validated) { - quantity() + price() subtotal() total() - price() + quantity() validated = true } } @@ -769,43 +769,21 @@ private constructor( class Builder { - private var quantity: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() private var subtotal: JsonField = JsonMissing.of() private var total: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() + private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(perPriceCost: PerPriceCost) = apply { - quantity = perPriceCost.quantity + price = perPriceCost.price subtotal = perPriceCost.subtotal total = perPriceCost.total - price = perPriceCost.price + quantity = perPriceCost.quantity additionalProperties = perPriceCost.additionalProperties.toMutableMap() } - /** The price's quantity for the timeframe */ - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - /** The price's quantity for the timeframe */ - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - - /** - * Price's contributions for the timeframe, excluding any minimums and discounts. - */ - fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) - - /** - * Price's contributions for the timeframe, excluding any minimums and discounts. - */ - fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(total: String) = total(JsonField.of(total)) - - /** Price's contributions for the timeframe, including minimums and discounts. */ - fun total(total: JsonField) = apply { this.total = total } - /** * The Price resource represents a price that can be billed on a subscription, * resulting in a charge on an invoice in the form of an invoice line item. Prices @@ -1274,6 +1252,28 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } + /** + * Price's contributions for the timeframe, excluding any minimums and discounts. + */ + fun subtotal(subtotal: String) = subtotal(JsonField.of(subtotal)) + + /** + * Price's contributions for the timeframe, excluding any minimums and discounts. + */ + fun subtotal(subtotal: JsonField) = apply { this.subtotal = subtotal } + + /** Price's contributions for the timeframe, including minimums and discounts. */ + fun total(total: String) = total(JsonField.of(total)) + + /** Price's contributions for the timeframe, including minimums and discounts. */ + fun total(total: JsonField) = apply { this.total = total } + + /** The price's quantity for the timeframe */ + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + /** The price's quantity for the timeframe */ + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1298,10 +1298,10 @@ private constructor( fun build(): PerPriceCost = PerPriceCost( - quantity, + price, subtotal, total, - price, + quantity, additionalProperties.toImmutable(), ) } @@ -1311,17 +1311,17 @@ private constructor( return true } - return /* spotless:off */ other is PerPriceCost && quantity == other.quantity && subtotal == other.subtotal && total == other.total && price == other.price && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PerPriceCost && price == other.price && subtotal == other.subtotal && total == other.total && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(quantity, subtotal, total, price, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(price, subtotal, total, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PerPriceCost{quantity=$quantity, subtotal=$subtotal, total=$total, price=$price, additionalProperties=$additionalProperties}" + "PerPriceCost{price=$price, subtotal=$subtotal, total=$total, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1329,17 +1329,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && subtotal == other.subtotal && total == other.total && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && perPriceCosts == other.perPriceCosts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && perPriceCosts == other.perPriceCosts && subtotal == other.subtotal && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && total == other.total && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(subtotal, total, timeframeStart, timeframeEnd, perPriceCosts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(perPriceCosts, subtotal, timeframeEnd, timeframeStart, total, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{subtotal=$subtotal, total=$total, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, perPriceCosts=$perPriceCosts, additionalProperties=$additionalProperties}" + "Data{perPriceCosts=$perPriceCosts, subtotal=$subtotal, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, total=$total, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt index 81710f22..5e4efdc6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt @@ -129,18 +129,43 @@ 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) = 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?) + + fun startDateGt(startDateGt: OffsetDateTime?) = apply { this.startDateGt = startDateGt } + + fun startDateGt(startDateGt: Optional) = + startDateGt(startDateGt.orElse(null)) + + fun startDateGte(startDateGte: OffsetDateTime?) = apply { this.startDateGte = startDateGte } + + fun startDateGte(startDateGte: Optional) = + startDateGte(startDateGte.orElse(null)) - fun startDateGt(startDateGt: OffsetDateTime) = apply { this.startDateGt = startDateGt } + fun startDateLt(startDateLt: OffsetDateTime?) = apply { this.startDateLt = startDateLt } - fun startDateGte(startDateGte: OffsetDateTime) = apply { this.startDateGte = startDateGte } + fun startDateLt(startDateLt: Optional) = + startDateLt(startDateLt.orElse(null)) - fun startDateLt(startDateLt: OffsetDateTime) = apply { this.startDateLt = startDateLt } + fun startDateLte(startDateLte: OffsetDateTime?) = apply { this.startDateLte = startDateLte } - fun startDateLte(startDateLte: OffsetDateTime) = apply { this.startDateLte = startDateLte } + fun startDateLte(startDateLte: Optional) = + startDateLte(startDateLte.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleResponse.kt index 306bd59d..5cf15f0d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleResponse.kt @@ -21,35 +21,35 @@ import java.util.Optional class SubscriptionFetchScheduleResponse @JsonCreator private constructor( - @JsonProperty("start_date") + @JsonProperty("created_at") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val createdAt: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - private val createdAt: JsonField = JsonMissing.of(), @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - fun plan(): Plan = plan.getRequired("plan") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -58,10 +58,10 @@ private constructor( fun validate(): SubscriptionFetchScheduleResponse = apply { if (!validated) { - startDate() - endDate() createdAt() + endDate() plan().validate() + startDate() validated = true } } @@ -75,39 +75,39 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var plan: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionFetchScheduleResponse: SubscriptionFetchScheduleResponse) = apply { - startDate = subscriptionFetchScheduleResponse.startDate - endDate = subscriptionFetchScheduleResponse.endDate createdAt = subscriptionFetchScheduleResponse.createdAt + endDate = subscriptionFetchScheduleResponse.endDate plan = subscriptionFetchScheduleResponse.plan + startDate = subscriptionFetchScheduleResponse.startDate additionalProperties = subscriptionFetchScheduleResponse.additionalProperties.toMutableMap() } - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - fun plan(plan: Plan) = plan(JsonField.of(plan)) fun plan(plan: JsonField) = apply { this.plan = plan } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -129,10 +129,10 @@ private constructor( fun build(): SubscriptionFetchScheduleResponse = SubscriptionFetchScheduleResponse( - startDate, - endDate, createdAt, + endDate, plan, + startDate, additionalProperties.toImmutable(), ) } @@ -288,15 +288,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionFetchScheduleResponse && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && plan == other.plan && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionFetchScheduleResponse && createdAt == other.createdAt && endDate == other.endDate && plan == other.plan && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, createdAt, plan, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(createdAt, endDate, plan, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionFetchScheduleResponse{startDate=$startDate, endDate=$endDate, createdAt=$createdAt, plan=$plan, additionalProperties=$additionalProperties}" + "SubscriptionFetchScheduleResponse{createdAt=$createdAt, endDate=$endDate, plan=$plan, startDate=$startDate, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt index 894bd445..dca1593f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt @@ -163,46 +163,87 @@ constructor( * billable metric. Note that both `group_by` and `billable_metric_id` must be specified * together. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - fun firstDimensionKey(firstDimensionKey: String) = apply { + /** + * When specified in conjunction with `group_by`, this parameter filters usage to a single + * billable metric. Note that both `group_by` and `billable_metric_id` must be specified + * together. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + fun firstDimensionKey(firstDimensionKey: String?) = apply { this.firstDimensionKey = firstDimensionKey } - fun firstDimensionValue(firstDimensionValue: String) = apply { + fun firstDimensionKey(firstDimensionKey: Optional) = + firstDimensionKey(firstDimensionKey.orElse(null)) + + fun firstDimensionValue(firstDimensionValue: String?) = apply { this.firstDimensionValue = firstDimensionValue } + fun firstDimensionValue(firstDimensionValue: Optional) = + firstDimensionValue(firstDimensionValue.orElse(null)) + + /** This determines the windowing of usage reporting. */ + fun granularity(granularity: Granularity?) = apply { this.granularity = granularity } + /** This determines the windowing of usage reporting. */ - fun granularity(granularity: Granularity) = apply { this.granularity = granularity } + fun granularity(granularity: Optional) = granularity(granularity.orElse(null)) + + /** Groups per-price usage by the key provided. */ + fun groupBy(groupBy: String?) = apply { this.groupBy = groupBy } /** Groups per-price usage by the key provided. */ - fun groupBy(groupBy: String) = apply { this.groupBy = groupBy } + fun groupBy(groupBy: Optional) = groupBy(groupBy.orElse(null)) - fun secondDimensionKey(secondDimensionKey: String) = apply { + fun secondDimensionKey(secondDimensionKey: String?) = apply { this.secondDimensionKey = secondDimensionKey } - fun secondDimensionValue(secondDimensionValue: String) = apply { + fun secondDimensionKey(secondDimensionKey: Optional) = + secondDimensionKey(secondDimensionKey.orElse(null)) + + fun secondDimensionValue(secondDimensionValue: String?) = apply { this.secondDimensionValue = secondDimensionValue } + fun secondDimensionValue(secondDimensionValue: Optional) = + secondDimensionValue(secondDimensionValue.orElse(null)) + + /** Usage returned is exclusive of `timeframe_end`. */ + fun timeframeEnd(timeframeEnd: OffsetDateTime?) = apply { this.timeframeEnd = timeframeEnd } + /** Usage returned is exclusive of `timeframe_end`. */ - fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: Optional) = + timeframeEnd(timeframeEnd.orElse(null)) /** Usage returned is inclusive of `timeframe_start`. */ - fun timeframeStart(timeframeStart: OffsetDateTime) = apply { + fun timeframeStart(timeframeStart: OffsetDateTime?) = apply { this.timeframeStart = timeframeStart } + /** Usage returned is inclusive of `timeframe_start`. */ + fun timeframeStart(timeframeStart: Optional) = + timeframeStart(timeframeStart.orElse(null)) + + /** + * Controls whether Orb returns cumulative usage since the start of the billing period, or + * incremental day-by-day usage. If your customer has minimums or discounts, it's strongly + * recommended that you use the default cumulative behavior. + */ + fun viewMode(viewMode: ViewMode?) = apply { this.viewMode = viewMode } + /** * Controls whether Orb returns cumulative usage since the start of the billing period, or * incremental day-by-day usage. If your customer has minimums or discounts, it's strongly * recommended that you use the default cumulative behavior. */ - fun viewMode(viewMode: ViewMode) = apply { this.viewMode = viewMode } + fun viewMode(viewMode: Optional) = viewMode(viewMode.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt index 3ff95a95..5ae61ad5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt @@ -134,36 +134,68 @@ constructor( additionalQueryParams = subscriptionListParams.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)) - fun customerId(customerId: List) = apply { - this.customerId = customerId.toMutableList() + fun customerId(customerId: List?) = apply { + this.customerId = customerId?.toMutableList() } + fun customerId(customerId: Optional>) = customerId(customerId.orElse(null)) + fun addCustomerId(customerId: String) = apply { this.customerId = (this.customerId ?: mutableListOf()).apply { add(customerId) } } - fun externalCustomerId(externalCustomerId: String) = apply { + fun externalCustomerId(externalCustomerId: String?) = apply { this.externalCustomerId = externalCustomerId } + 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) = 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 status(status: Status?) = apply { this.status = status } - fun status(status: Status) = apply { this.status = status } + fun status(status: Optional) = status(status.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index 63ed4378..6bc09978 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -130,7 +130,10 @@ constructor( } /** A list of price intervals to add to the subscription. */ - fun add(add: List) = apply { this.add = add.toMutableList() } + fun add(add: List?) = apply { this.add = add?.toMutableList() } + + /** A list of price intervals to add to the subscription. */ + fun add(add: Optional>) = add(add.orElse(null)) /** A list of price intervals to add to the subscription. */ fun addAdd(add: Add) = apply { @@ -138,17 +141,24 @@ constructor( } /** A list of adjustments to add to the subscription. */ - fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments = addAdjustments.toMutableList() + fun addAdjustments(addAdjustments: List?) = apply { + this.addAdjustments = addAdjustments?.toMutableList() } + /** A list of adjustments to add to the subscription. */ + fun addAdjustments(addAdjustments: Optional>) = + addAdjustments(addAdjustments.orElse(null)) + /** A list of adjustments to add to the subscription. */ fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { addAdjustments = (addAdjustments ?: mutableListOf()).apply { add(addAdjustment) } } /** A list of price intervals to edit on the subscription. */ - fun edit(edit: List) = apply { this.edit = edit.toMutableList() } + fun edit(edit: List?) = apply { this.edit = edit?.toMutableList() } + + /** A list of price intervals to edit on the subscription. */ + fun edit(edit: Optional>) = edit(edit.orElse(null)) /** A list of price intervals to edit on the subscription. */ fun addEdit(edit: Edit) = apply { @@ -156,10 +166,14 @@ constructor( } /** A list of adjustments to edit on the subscription. */ - fun editAdjustments(editAdjustments: List) = apply { - this.editAdjustments = editAdjustments.toMutableList() + fun editAdjustments(editAdjustments: List?) = apply { + this.editAdjustments = editAdjustments?.toMutableList() } + /** A list of adjustments to edit on the subscription. */ + fun editAdjustments(editAdjustments: Optional>) = + editAdjustments(editAdjustments.orElse(null)) + /** A list of adjustments to edit on the subscription. */ fun addEditAdjustment(editAdjustment: EditAdjustment) = apply { editAdjustments = (editAdjustments ?: mutableListOf()).apply { add(editAdjustment) } @@ -241,32 +255,46 @@ constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } /** A list of price intervals to add to the subscription. */ - fun add(add: List) = apply { body.add(add) } + fun add(add: List?) = apply { body.add(add) } + + /** A list of price intervals to add to the subscription. */ + fun add(add: Optional>) = add(add.orElse(null)) /** A list of price intervals to add to the subscription. */ fun addAdd(add: Add) = apply { body.addAdd(add) } /** A list of adjustments to add to the subscription. */ - fun addAdjustments(addAdjustments: List) = apply { + fun addAdjustments(addAdjustments: List?) = apply { body.addAdjustments(addAdjustments) } + /** A list of adjustments to add to the subscription. */ + fun addAdjustments(addAdjustments: Optional>) = + addAdjustments(addAdjustments.orElse(null)) + /** A list of adjustments to add to the subscription. */ fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { body.addAddAdjustment(addAdjustment) } /** A list of price intervals to edit on the subscription. */ - fun edit(edit: List) = apply { body.edit(edit) } + fun edit(edit: List?) = apply { body.edit(edit) } + + /** A list of price intervals to edit on the subscription. */ + fun edit(edit: Optional>) = edit(edit.orElse(null)) /** A list of price intervals to edit on the subscription. */ fun addEdit(edit: Edit) = apply { body.addEdit(edit) } /** A list of adjustments to edit on the subscription. */ - fun editAdjustments(editAdjustments: List) = apply { + fun editAdjustments(editAdjustments: List?) = apply { body.editAdjustments(editAdjustments) } + /** A list of adjustments to edit on the subscription. */ + fun editAdjustments(editAdjustments: Optional>) = + editAdjustments(editAdjustments.orElse(null)) + /** A list of adjustments to edit on the subscription. */ fun addEditAdjustment(editAdjustment: EditAdjustment) = apply { body.addEditAdjustment(editAdjustment) @@ -402,55 +430,56 @@ constructor( class Add @JsonCreator private constructor( - @JsonProperty("price_id") private val priceId: String?, - @JsonProperty("external_price_id") private val externalPriceId: String?, - @JsonProperty("price") private val price: Price?, - @JsonProperty("allocation_price") private val allocationPrice: AllocationPrice?, @JsonProperty("start_date") private val startDate: StartDate, + @JsonProperty("allocation_price") private val allocationPrice: AllocationPrice?, + @JsonProperty("discounts") private val discounts: List?, @JsonProperty("end_date") private val endDate: EndDate?, + @JsonProperty("external_price_id") private val externalPriceId: String?, @JsonProperty("fixed_fee_quantity_transitions") private val fixedFeeQuantityTransitions: List?, - @JsonProperty("discounts") private val discounts: List?, - @JsonProperty("minimum_amount") private val minimumAmount: Double?, @JsonProperty("maximum_amount") private val maximumAmount: Double?, + @JsonProperty("minimum_amount") private val minimumAmount: Double?, + @JsonProperty("price") private val price: Price?, + @JsonProperty("price_id") private val priceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the price to add to the subscription. */ - @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) - - /** The external price id of the price to add to the subscription. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) - - /** The definition of a new price to create and add to the subscription. */ - @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) - - /** The definition of a new allocation price to create and add to the subscription. */ - @JsonProperty("allocation_price") - fun allocationPrice(): Optional = Optional.ofNullable(allocationPrice) - /** * The start date of the price interval. This is the date that the price will start billing * on the subscription. */ @JsonProperty("start_date") fun startDate(): StartDate = startDate + /** The definition of a new allocation price to create and add to the subscription. */ + @JsonProperty("allocation_price") + fun allocationPrice(): Optional = Optional.ofNullable(allocationPrice) + + /** A list of discounts to initialize on the price interval. */ + @JsonProperty("discounts") + fun discounts(): Optional> = Optional.ofNullable(discounts) + /** * The end date of the price interval. This is the date that the price will stop billing on * the subscription. */ @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) + /** The external price id of the price to add to the subscription. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** A list of fixed fee quantity transitions to initialize on the price interval. */ @JsonProperty("fixed_fee_quantity_transitions") fun fixedFeeQuantityTransitions(): Optional> = Optional.ofNullable(fixedFeeQuantityTransitions) - /** A list of discounts to initialize on the price interval. */ - @JsonProperty("discounts") - fun discounts(): Optional> = Optional.ofNullable(discounts) + /** + * The maximum amount that will be billed for this price interval for a given billing + * period. + */ + @JsonProperty("maximum_amount") + fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) /** * The minimum amount that will be billed for this price interval for a given billing @@ -459,12 +488,11 @@ constructor( @JsonProperty("minimum_amount") fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) - /** - * The maximum amount that will be billed for this price interval for a given billing - * period. - */ - @JsonProperty("maximum_amount") - fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) + /** The definition of a new price to create and add to the subscription. */ + @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) + + /** The id of the price to add to the subscription. */ + @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) @JsonAnyGetter @ExcludeMissing @@ -479,43 +507,165 @@ constructor( class Builder { - private var priceId: String? = null - private var externalPriceId: String? = null - private var price: Price? = null - private var allocationPrice: AllocationPrice? = null private var startDate: StartDate? = null + private var allocationPrice: AllocationPrice? = null + private var discounts: MutableList? = null private var endDate: EndDate? = null + private var externalPriceId: String? = null private var fixedFeeQuantityTransitions: MutableList? = null - private var discounts: MutableList? = null - private var minimumAmount: Double? = null private var maximumAmount: Double? = null + private var minimumAmount: Double? = null + private var price: Price? = null + private var priceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(add: Add) = apply { - priceId = add.priceId - externalPriceId = add.externalPriceId - price = add.price - allocationPrice = add.allocationPrice startDate = add.startDate + allocationPrice = add.allocationPrice + discounts = add.discounts?.toMutableList() endDate = add.endDate + externalPriceId = add.externalPriceId fixedFeeQuantityTransitions = add.fixedFeeQuantityTransitions?.toMutableList() - discounts = add.discounts?.toMutableList() - minimumAmount = add.minimumAmount maximumAmount = add.maximumAmount + minimumAmount = add.minimumAmount + price = add.price + priceId = add.priceId additionalProperties = add.additionalProperties.toMutableMap() } - /** The id of the price to add to the subscription. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } + /** + * The start date of the price interval. This is the date that the price will start + * billing on the subscription. + */ + fun startDate(startDate: StartDate) = apply { this.startDate = startDate } + + fun startDate(dateTime: OffsetDateTime) = apply { + this.startDate = StartDate.ofDateTime(dateTime) + } + + fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + + /** The definition of a new allocation price to create and add to the subscription. */ + fun allocationPrice(allocationPrice: AllocationPrice?) = apply { + this.allocationPrice = allocationPrice + } + + /** The definition of a new allocation price to create and add to the subscription. */ + fun allocationPrice(allocationPrice: Optional) = + allocationPrice(allocationPrice.orElse(null)) + + /** A list of discounts to initialize on the price interval. */ + fun discounts(discounts: List?) = apply { + this.discounts = discounts?.toMutableList() + } + + /** A list of discounts to initialize on the price interval. */ + fun discounts(discounts: Optional>) = discounts(discounts.orElse(null)) + + /** A list of discounts to initialize on the price interval. */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } + + /** + * The end date of the price interval. This is the date that the price will stop billing + * on the subscription. + */ + fun endDate(endDate: EndDate?) = apply { this.endDate = endDate } + + /** + * The end date of the price interval. This is the date that the price will stop billing + * on the subscription. + */ + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + + fun endDate(dateTime: OffsetDateTime) = apply { + this.endDate = EndDate.ofDateTime(dateTime) + } + + fun endDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.endDate = EndDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } /** The external price id of the price to add to the subscription. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** The external price id of the price to add to the subscription. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** A list of fixed fee quantity transitions to initialize on the price interval. */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List? + ) = apply { + this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions?.toMutableList() + } + + /** A list of fixed fee quantity transitions to initialize on the price interval. */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: Optional> + ) = fixedFeeQuantityTransitions(fixedFeeQuantityTransitions.orElse(null)) + + /** A list of fixed fee quantity transitions to initialize on the price interval. */ + fun addFixedFeeQuantityTransition( + fixedFeeQuantityTransition: FixedFeeQuantityTransition + ) = apply { + fixedFeeQuantityTransitions = + (fixedFeeQuantityTransitions ?: mutableListOf()).apply { + add(fixedFeeQuantityTransition) + } + } + + /** + * The maximum amount that will be billed for this price interval for a given billing + * period. + */ + fun maximumAmount(maximumAmount: Double?) = apply { this.maximumAmount = maximumAmount } + + /** + * The maximum amount that will be billed for this price interval for a given billing + * period. + */ + fun maximumAmount(maximumAmount: Double) = maximumAmount(maximumAmount as Double?) + + /** + * The maximum amount that will be billed for this price interval for a given billing + * period. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null) as Double?) + + /** + * The minimum amount that will be billed for this price interval for a given billing + * period. + */ + fun minimumAmount(minimumAmount: Double?) = apply { this.minimumAmount = minimumAmount } + + /** + * The minimum amount that will be billed for this price interval for a given billing + * period. + */ + fun minimumAmount(minimumAmount: Double) = minimumAmount(minimumAmount as Double?) + + /** + * The minimum amount that will be billed for this price interval for a given billing + * period. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null) as Double?) + /** The definition of a new price to create and add to the subscription. */ - fun price(price: Price) = apply { this.price = price } + fun price(price: Price?) = apply { this.price = price } + + /** The definition of a new price to create and add to the subscription. */ + fun price(price: Optional) = price(price.orElse(null)) fun price(newFloatingUnitPrice: Price.NewFloatingUnitPrice) = apply { this.price = Price.ofNewFloatingUnitPrice(newFloatingUnitPrice) @@ -669,109 +819,43 @@ constructor( ) } - /** The definition of a new allocation price to create and add to the subscription. */ - fun allocationPrice(allocationPrice: AllocationPrice) = apply { - this.allocationPrice = allocationPrice - } - - /** - * The start date of the price interval. This is the date that the price will start - * billing on the subscription. - */ - fun startDate(startDate: StartDate) = apply { this.startDate = startDate } - - fun startDate(dateTime: OffsetDateTime) = apply { - this.startDate = StartDate.ofDateTime(dateTime) - } - - fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { - this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) - } - - /** - * The end date of the price interval. This is the date that the price will stop billing - * on the subscription. - */ - fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: String?) = apply { this.priceId = priceId } - fun endDate(dateTime: OffsetDateTime) = apply { - this.endDate = EndDate.ofDateTime(dateTime) - } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: Optional) = priceId(priceId.orElse(null)) - fun endDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { - this.endDate = EndDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** A list of fixed fee quantity transitions to initialize on the price interval. */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = apply { - this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions.toMutableList() + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** A list of fixed fee quantity transitions to initialize on the price interval. */ - fun addFixedFeeQuantityTransition( - fixedFeeQuantityTransition: FixedFeeQuantityTransition - ) = apply { - fixedFeeQuantityTransitions = - (fixedFeeQuantityTransitions ?: mutableListOf()).apply { - add(fixedFeeQuantityTransition) - } + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) } - /** A list of discounts to initialize on the price interval. */ - fun discounts(discounts: List) = apply { - this.discounts = discounts.toMutableList() - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - /** A list of discounts to initialize on the price interval. */ - fun addDiscount(discount: Discount) = apply { - discounts = (discounts ?: mutableListOf()).apply { add(discount) } - } - - /** - * The minimum amount that will be billed for this price interval for a given billing - * period. - */ - fun minimumAmount(minimumAmount: Double) = apply { this.minimumAmount = minimumAmount } - - /** - * The maximum amount that will be billed for this price interval for a given billing - * period. - */ - fun maximumAmount(maximumAmount: Double) = apply { this.maximumAmount = maximumAmount } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } fun build(): Add = Add( - priceId, - externalPriceId, - price, - allocationPrice, checkNotNull(startDate) { "`startDate` is required but was not set" }, + allocationPrice, + discounts?.toImmutable(), endDate, + externalPriceId, fixedFeeQuantityTransitions?.toImmutable(), - discounts?.toImmutable(), - minimumAmount, maximumAmount, + minimumAmount, + price, + priceId, additionalProperties.toImmutable(), ) } @@ -894,26 +978,26 @@ constructor( class AllocationPrice @JsonCreator private constructor( - @JsonProperty("currency") private val currency: String, @JsonProperty("amount") private val amount: String, @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, @JsonProperty("expires_at_end_of_cadence") private val expiresAtEndOfCadence: Boolean, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * An ISO 4217 currency string or a custom pricing unit identifier in which to bill this - * price. - */ - @JsonProperty("currency") fun currency(): String = currency - /** An amount of the currency to allocate to the customer at the specified cadence. */ @JsonProperty("amount") fun amount(): String = amount /** The cadence at which to allocate the amount to the customer. */ @JsonProperty("cadence") fun cadence(): Cadence = cadence + /** + * An ISO 4217 currency string or a custom pricing unit identifier in which to bill this + * price. + */ + @JsonProperty("currency") fun currency(): String = currency + /** * Whether the allocated amount should expire at the end of the cadence or roll over to * the next period. @@ -934,27 +1018,21 @@ constructor( class Builder { - private var currency: String? = null private var amount: String? = null private var cadence: Cadence? = null + private var currency: String? = null private var expiresAtEndOfCadence: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(allocationPrice: AllocationPrice) = apply { - currency = allocationPrice.currency amount = allocationPrice.amount cadence = allocationPrice.cadence + currency = allocationPrice.currency expiresAtEndOfCadence = allocationPrice.expiresAtEndOfCadence additionalProperties = allocationPrice.additionalProperties.toMutableMap() } - /** - * An ISO 4217 currency string or a custom pricing unit identifier in which to bill - * this price. - */ - fun currency(currency: String) = apply { this.currency = currency } - /** * An amount of the currency to allocate to the customer at the specified cadence. */ @@ -963,6 +1041,12 @@ constructor( /** The cadence at which to allocate the amount to the customer. */ fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * An ISO 4217 currency string or a custom pricing unit identifier in which to bill + * this price. + */ + fun currency(currency: String) = apply { this.currency = currency } + /** * Whether the allocated amount should expire at the end of the cadence or roll over * to the next period. @@ -995,9 +1079,9 @@ constructor( fun build(): AllocationPrice = AllocationPrice( - checkNotNull(currency) { "`currency` is required but was not set" }, checkNotNull(amount) { "`amount` is required but was not set" }, checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, checkNotNull(expiresAtEndOfCadence) { "`expiresAtEndOfCadence` is required but was not set" }, @@ -1091,17 +1175,17 @@ constructor( return true } - return /* spotless:off */ other is AllocationPrice && currency == other.currency && amount == other.amount && cadence == other.cadence && expiresAtEndOfCadence == other.expiresAtEndOfCadence && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AllocationPrice && amount == other.amount && cadence == other.cadence && currency == other.currency && expiresAtEndOfCadence == other.expiresAtEndOfCadence && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, amount, cadence, expiresAtEndOfCadence, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, cadence, currency, expiresAtEndOfCadence, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AllocationPrice{currency=$currency, amount=$amount, cadence=$cadence, expiresAtEndOfCadence=$expiresAtEndOfCadence, additionalProperties=$additionalProperties}" + "AllocationPrice{amount=$amount, cadence=$cadence, currency=$currency, expiresAtEndOfCadence=$expiresAtEndOfCadence, additionalProperties=$additionalProperties}" } @JsonDeserialize(using = Discount.Deserializer::class) @@ -1273,17 +1357,17 @@ constructor( class AmountDiscountCreationParams @JsonCreator private constructor( - @JsonProperty("discount_type") private val discountType: DiscountType, @JsonProperty("amount_discount") private val amountDiscount: Double, + @JsonProperty("discount_type") private val discountType: DiscountType, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("discount_type") fun discountType(): DiscountType = discountType - /** Only available if discount_type is `amount`. */ @JsonProperty("amount_discount") fun amountDiscount(): Double = amountDiscount + @JsonProperty("discount_type") fun discountType(): DiscountType = discountType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1297,28 +1381,28 @@ constructor( class Builder { - private var discountType: DiscountType? = null private var amountDiscount: Double? = null + private var discountType: DiscountType? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountCreationParams: AmountDiscountCreationParams) = apply { - discountType = amountDiscountCreationParams.discountType amountDiscount = amountDiscountCreationParams.amountDiscount + discountType = amountDiscountCreationParams.discountType additionalProperties = amountDiscountCreationParams.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: Double) = apply { this.amountDiscount = amountDiscount } + fun discountType(discountType: DiscountType) = apply { + this.discountType = discountType + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1343,12 +1427,12 @@ constructor( fun build(): AmountDiscountCreationParams = AmountDiscountCreationParams( - 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(), ) } @@ -1410,17 +1494,17 @@ constructor( return true } - return /* spotless:off */ other is AmountDiscountCreationParams && discountType == other.discountType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountCreationParams && 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() = - "AmountDiscountCreationParams{discountType=$discountType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountCreationParams{amountDiscount=$amountDiscount, discountType=$discountType, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1863,18 +1947,18 @@ constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("quantity") private val quantity: Long, @JsonProperty("effective_date") private val effectiveDate: OffsetDateTime, + @JsonProperty("quantity") private val quantity: Long, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The quantity of the fixed fee quantity transition. */ - @JsonProperty("quantity") fun quantity(): Long = quantity - /** The date that the fixed fee quantity transition should take effect. */ @JsonProperty("effective_date") fun effectiveDate(): OffsetDateTime = effectiveDate + /** The quantity of the fixed fee quantity transition. */ + @JsonProperty("quantity") fun quantity(): Long = quantity + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1888,26 +1972,26 @@ constructor( class Builder { - private var quantity: Long? = null private var effectiveDate: OffsetDateTime? = null + private var quantity: Long? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - quantity = fixedFeeQuantityTransition.quantity effectiveDate = fixedFeeQuantityTransition.effectiveDate + quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - /** The quantity of the fixed fee quantity transition. */ - fun quantity(quantity: Long) = apply { this.quantity = quantity } - /** The date that the fixed fee quantity transition should take effect. */ fun effectiveDate(effectiveDate: OffsetDateTime) = apply { this.effectiveDate = effectiveDate } + /** The quantity of the fixed fee quantity transition. */ + fun quantity(quantity: Long) = apply { this.quantity = quantity } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1932,10 +2016,10 @@ constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - checkNotNull(quantity) { "`quantity` is required but was not set" }, checkNotNull(effectiveDate) { "`effectiveDate` is required but was not set" }, + checkNotNull(quantity) { "`quantity` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -1945,17 +2029,17 @@ constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && quantity == other.quantity && effectiveDate == other.effectiveDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(quantity, effectiveDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{quantity=$quantity, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" } /** The definition of a new price to create and add to the subscription. */ @@ -2932,42 +3016,43 @@ constructor( class NewFloatingUnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_config") private val unitConfig: UnitConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -2975,9 +3060,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -2985,6 +3067,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -2996,17 +3094,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -3015,16 +3102,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -3039,124 +3123,205 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitConfig: UnitConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitConfig: UnitConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingUnitPrice: NewFloatingUnitPrice) = apply { - metadata = newFloatingUnitPrice.metadata - externalPriceId = newFloatingUnitPrice.externalPriceId + cadence = newFloatingUnitPrice.cadence + currency = newFloatingUnitPrice.currency + itemId = newFloatingUnitPrice.itemId + modelType = newFloatingUnitPrice.modelType name = newFloatingUnitPrice.name + unitConfig = newFloatingUnitPrice.unitConfig billableMetricId = newFloatingUnitPrice.billableMetricId - itemId = newFloatingUnitPrice.itemId billedInAdvance = newFloatingUnitPrice.billedInAdvance + billingCycleConfiguration = newFloatingUnitPrice.billingCycleConfiguration + conversionRate = newFloatingUnitPrice.conversionRate + externalPriceId = newFloatingUnitPrice.externalPriceId fixedPriceQuantity = newFloatingUnitPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingUnitPrice.invoiceGroupingKey - cadence = newFloatingUnitPrice.cadence - billingCycleConfiguration = newFloatingUnitPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingUnitPrice.invoicingCycleConfiguration - conversionRate = newFloatingUnitPrice.conversionRate - modelType = newFloatingUnitPrice.modelType - unitConfig = newFloatingUnitPrice.unitConfig - currency = newFloatingUnitPrice.currency + metadata = newFloatingUnitPrice.metadata additionalProperties = newFloatingUnitPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } - /** + fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3182,21 +3347,21 @@ constructor( fun build(): NewFloatingUnitPrice = NewFloatingUnitPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -3832,59 +3997,60 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingUnitPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitConfig == other.unitConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingUnitPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingUnitPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitConfig=$unitConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingUnitPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_config") private val packageConfig: PackageConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -3892,9 +4058,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -3902,6 +4065,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -3913,17 +4092,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -3932,16 +4100,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -3956,127 +4121,208 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageConfig: PackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageConfig: PackageConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingPackagePrice: NewFloatingPackagePrice) = apply { - metadata = newFloatingPackagePrice.metadata - externalPriceId = newFloatingPackagePrice.externalPriceId + cadence = newFloatingPackagePrice.cadence + currency = newFloatingPackagePrice.currency + itemId = newFloatingPackagePrice.itemId + modelType = newFloatingPackagePrice.modelType name = newFloatingPackagePrice.name + packageConfig = newFloatingPackagePrice.packageConfig billableMetricId = newFloatingPackagePrice.billableMetricId - itemId = newFloatingPackagePrice.itemId billedInAdvance = newFloatingPackagePrice.billedInAdvance - fixedPriceQuantity = newFloatingPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingPackagePrice.invoiceGroupingKey - cadence = newFloatingPackagePrice.cadence billingCycleConfiguration = newFloatingPackagePrice.billingCycleConfiguration + conversionRate = newFloatingPackagePrice.conversionRate + externalPriceId = newFloatingPackagePrice.externalPriceId + fixedPriceQuantity = newFloatingPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingPackagePrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingPackagePrice.invoicingCycleConfiguration - conversionRate = newFloatingPackagePrice.conversionRate - modelType = newFloatingPackagePrice.modelType - packageConfig = newFloatingPackagePrice.packageConfig - currency = newFloatingPackagePrice.currency + metadata = newFloatingPackagePrice.metadata additionalProperties = newFloatingPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageConfig(packageConfig: PackageConfig) = apply { + this.packageConfig = packageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun packageConfig(packageConfig: PackageConfig) = apply { - this.packageConfig = packageConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4102,23 +4348,23 @@ constructor( fun build(): NewFloatingPackagePrice = NewFloatingPackagePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(packageConfig) { + "`packageConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(packageConfig) { - "`packageConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -4776,55 +5022,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageConfig == other.packageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingPackagePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageConfig=$packageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingPackagePrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingMatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -4836,9 +5083,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -4846,6 +5090,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -4857,17 +5117,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -4876,16 +5125,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -4900,57 +5146,60 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var matrixConfig: MatrixConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixConfig: MatrixConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingMatrixPrice: NewFloatingMatrixPrice) = apply { - metadata = newFloatingMatrixPrice.metadata - externalPriceId = newFloatingMatrixPrice.externalPriceId + cadence = newFloatingMatrixPrice.cadence + currency = newFloatingMatrixPrice.currency + itemId = newFloatingMatrixPrice.itemId + matrixConfig = newFloatingMatrixPrice.matrixConfig + modelType = newFloatingMatrixPrice.modelType name = newFloatingMatrixPrice.name billableMetricId = newFloatingMatrixPrice.billableMetricId - itemId = newFloatingMatrixPrice.itemId billedInAdvance = newFloatingMatrixPrice.billedInAdvance + billingCycleConfiguration = newFloatingMatrixPrice.billingCycleConfiguration + conversionRate = newFloatingMatrixPrice.conversionRate + externalPriceId = newFloatingMatrixPrice.externalPriceId fixedPriceQuantity = newFloatingMatrixPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingMatrixPrice.invoiceGroupingKey - cadence = newFloatingMatrixPrice.cadence - billingCycleConfiguration = newFloatingMatrixPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingMatrixPrice.invoicingCycleConfiguration - conversionRate = newFloatingMatrixPrice.conversionRate - modelType = newFloatingMatrixPrice.modelType - matrixConfig = newFloatingMatrixPrice.matrixConfig - currency = newFloatingMatrixPrice.currency + metadata = newFloatingMatrixPrice.metadata additionalProperties = newFloatingMatrixPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = apply { + this.matrixConfig = matrixConfig } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -4958,68 +5207,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun matrixConfig(matrixConfig: MatrixConfig) = apply { - this.matrixConfig = matrixConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5045,23 +5372,23 @@ constructor( fun build(): NewFloatingMatrixPrice = NewFloatingMatrixPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixConfig) { + "`matrixConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixConfig) { - "`matrixConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -5152,16 +5479,13 @@ constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions - /** * Default per unit rate for any usage not bucketed into a specified * matrix_value @@ -5169,6 +5493,9 @@ constructor( @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues @@ -5186,20 +5513,28 @@ constructor( class Builder { - private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions.toMutableList() defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.toMutableList() matrixValues = matrixConfig.matrixValues.toMutableList() additionalProperties = matrixConfig.additionalProperties.toMutableMap() } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -5210,14 +5545,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified - * matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -5253,13 +5580,13 @@ constructor( fun build(): MatrixConfig = MatrixConfig( + checkNotNull(defaultUnitAmount) { + "`defaultUnitAmount` is required but was not set" + }, checkNotNull(dimensions) { "`dimensions` is required but was not set" } .toImmutable(), - checkNotNull(defaultUnitAmount) { - "`defaultUnitAmount` is required but was not set" - }, checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } @@ -5272,17 +5599,14 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -5291,6 +5615,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -5304,24 +5631,19 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -5343,6 +5665,11 @@ constructor( } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5367,13 +5694,13 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { - "`unitAmount` is required but was not set" - }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { + "`unitAmount` is required but was not set" + }, additionalProperties.toImmutable(), ) } @@ -5383,17 +5710,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5401,17 +5728,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -5876,56 +6203,59 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingMatrixPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixConfig == other.matrixConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingMatrixPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMatrixPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixConfig=$matrixConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingMatrixPrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingMatrixWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_with_allocation_config") + private val matrixWithAllocationConfig: MatrixWithAllocationConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_with_allocation_config") - private val matrixWithAllocationConfig: MatrixWithAllocationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_with_allocation_config") + fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = + matrixWithAllocationConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -5937,9 +6267,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -5947,6 +6274,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -5958,17 +6301,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -5977,18 +6309,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_with_allocation_config") - fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = - matrixWithAllocationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -6003,60 +6330,63 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var matrixWithAllocationConfig: MatrixWithAllocationConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixWithAllocationConfig: MatrixWithAllocationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice ) = apply { - metadata = newFloatingMatrixWithAllocationPrice.metadata - externalPriceId = newFloatingMatrixWithAllocationPrice.externalPriceId + cadence = newFloatingMatrixWithAllocationPrice.cadence + currency = newFloatingMatrixWithAllocationPrice.currency + itemId = newFloatingMatrixWithAllocationPrice.itemId + matrixWithAllocationConfig = + newFloatingMatrixWithAllocationPrice.matrixWithAllocationConfig + modelType = newFloatingMatrixWithAllocationPrice.modelType name = newFloatingMatrixWithAllocationPrice.name billableMetricId = newFloatingMatrixWithAllocationPrice.billableMetricId - itemId = newFloatingMatrixWithAllocationPrice.itemId billedInAdvance = newFloatingMatrixWithAllocationPrice.billedInAdvance - fixedPriceQuantity = newFloatingMatrixWithAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingMatrixWithAllocationPrice.invoiceGroupingKey - cadence = newFloatingMatrixWithAllocationPrice.cadence billingCycleConfiguration = newFloatingMatrixWithAllocationPrice.billingCycleConfiguration + conversionRate = newFloatingMatrixWithAllocationPrice.conversionRate + externalPriceId = newFloatingMatrixWithAllocationPrice.externalPriceId + fixedPriceQuantity = newFloatingMatrixWithAllocationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingMatrixWithAllocationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingMatrixWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newFloatingMatrixWithAllocationPrice.conversionRate - modelType = newFloatingMatrixWithAllocationPrice.modelType - matrixWithAllocationConfig = - newFloatingMatrixWithAllocationPrice.matrixWithAllocationConfig - currency = newFloatingMatrixWithAllocationPrice.currency + metadata = newFloatingMatrixWithAllocationPrice.metadata additionalProperties = newFloatingMatrixWithAllocationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixWithAllocationConfig( + matrixWithAllocationConfig: MatrixWithAllocationConfig + ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -6065,68 +6395,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun matrixWithAllocationConfig( - matrixWithAllocationConfig: MatrixWithAllocationConfig - ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6152,23 +6560,23 @@ constructor( fun build(): NewFloatingMatrixWithAllocationPrice = NewFloatingMatrixWithAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixWithAllocationConfig) { + "`matrixWithAllocationConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixWithAllocationConfig) { - "`matrixWithAllocationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -6259,16 +6667,16 @@ constructor( class MatrixWithAllocationConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, + @JsonProperty("allocation") private val allocation: Double, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, - @JsonProperty("allocation") private val allocation: Double, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Allocation to be used to calculate the price */ + @JsonProperty("allocation") fun allocation(): Double = allocation /** * Default per unit rate for any usage not bucketed into a specified @@ -6277,13 +6685,13 @@ constructor( @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues - /** Allocation to be used to calculate the price */ - @JsonProperty("allocation") fun allocation(): Double = allocation - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6297,25 +6705,36 @@ constructor( class Builder { - private var dimensions: MutableList? = null + private var allocation: Double? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null - private var allocation: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixWithAllocationConfig: MatrixWithAllocationConfig) = apply { - dimensions = matrixWithAllocationConfig.dimensions.toMutableList() + allocation = matrixWithAllocationConfig.allocation defaultUnitAmount = matrixWithAllocationConfig.defaultUnitAmount + dimensions = matrixWithAllocationConfig.dimensions.toMutableList() matrixValues = matrixWithAllocationConfig.matrixValues.toMutableList() - allocation = matrixWithAllocationConfig.allocation additionalProperties = matrixWithAllocationConfig.additionalProperties.toMutableMap() } + /** Allocation to be used to calculate the price */ + fun allocation(allocation: Double) = apply { this.allocation = allocation } + + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -6326,14 +6745,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified - * matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -6345,9 +6756,6 @@ constructor( (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } - /** Allocation to be used to calculate the price */ - fun allocation(allocation: Double) = apply { this.allocation = allocation } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6372,20 +6780,20 @@ constructor( fun build(): MatrixWithAllocationConfig = MatrixWithAllocationConfig( + checkNotNull(allocation) { + "`allocation` is required but was not set" + }, + checkNotNull(defaultUnitAmount) { + "`defaultUnitAmount` is required but was not set" + }, checkNotNull(dimensions) { "`dimensions` is required but was not set" } .toImmutable(), - checkNotNull(defaultUnitAmount) { - "`defaultUnitAmount` is required but was not set" - }, checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } .toImmutable(), - checkNotNull(allocation) { - "`allocation` is required but was not set" - }, additionalProperties.toImmutable(), ) } @@ -6394,17 +6802,14 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -6413,6 +6818,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6426,24 +6834,19 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -6465,6 +6868,11 @@ constructor( } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6489,13 +6897,13 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { - "`unitAmount` is required but was not set" - }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { + "`unitAmount` is required but was not set" + }, additionalProperties.toImmutable(), ) } @@ -6505,17 +6913,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -6523,17 +6931,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixWithAllocationConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && allocation == other.allocation && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithAllocationConfig && allocation == other.allocation && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, allocation, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allocation, defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithAllocationConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, allocation=$allocation, additionalProperties=$additionalProperties}" + "MatrixWithAllocationConfig{allocation=$allocation, defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -6998,59 +7406,60 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingMatrixWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixWithAllocationConfig == other.matrixWithAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingMatrixWithAllocationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && matrixWithAllocationConfig == other.matrixWithAllocationConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixWithAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithAllocationConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMatrixWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixWithAllocationConfig=$matrixWithAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingMatrixWithAllocationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixWithAllocationConfig=$matrixWithAllocationConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -7058,9 +7467,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -7068,6 +7474,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -7079,17 +7501,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -7098,16 +7509,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -7122,126 +7530,207 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredConfig: TieredConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredConfig: TieredConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingTieredPrice: NewFloatingTieredPrice) = apply { - metadata = newFloatingTieredPrice.metadata - externalPriceId = newFloatingTieredPrice.externalPriceId + cadence = newFloatingTieredPrice.cadence + currency = newFloatingTieredPrice.currency + itemId = newFloatingTieredPrice.itemId + modelType = newFloatingTieredPrice.modelType name = newFloatingTieredPrice.name + tieredConfig = newFloatingTieredPrice.tieredConfig billableMetricId = newFloatingTieredPrice.billableMetricId - itemId = newFloatingTieredPrice.itemId billedInAdvance = newFloatingTieredPrice.billedInAdvance + billingCycleConfiguration = newFloatingTieredPrice.billingCycleConfiguration + conversionRate = newFloatingTieredPrice.conversionRate + externalPriceId = newFloatingTieredPrice.externalPriceId fixedPriceQuantity = newFloatingTieredPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingTieredPrice.invoiceGroupingKey - cadence = newFloatingTieredPrice.cadence - billingCycleConfiguration = newFloatingTieredPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingTieredPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredPrice.conversionRate - modelType = newFloatingTieredPrice.modelType - tieredConfig = newFloatingTieredPrice.tieredConfig - currency = newFloatingTieredPrice.currency + metadata = newFloatingTieredPrice.metadata additionalProperties = newFloatingTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredConfig(tieredConfig: TieredConfig) = apply { + this.tieredConfig = tieredConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredConfig(tieredConfig: TieredConfig) = apply { - this.tieredConfig = tieredConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7267,23 +7756,23 @@ constructor( fun build(): NewFloatingTieredPrice = NewFloatingTieredPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredConfig) { + "`tieredConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredConfig) { - "`tieredConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -7504,8 +7993,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("first_unit") private val firstUnit: Double, - @JsonProperty("last_unit") private val lastUnit: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("last_unit") private val lastUnit: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), @@ -7514,15 +8003,15 @@ constructor( /** Inclusive tier starting value */ @JsonProperty("first_unit") fun firstUnit(): Double = firstUnit + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** * Exclusive tier ending value. If null, this is treated as the last tier */ @JsonProperty("last_unit") fun lastUnit(): Optional = Optional.ofNullable(lastUnit) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7537,32 +8026,48 @@ constructor( class Builder { private var firstUnit: Double? = null - private var lastUnit: Double? = null private var unitAmount: String? = null + private var lastUnit: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } /** Inclusive tier starting value */ fun firstUnit(firstUnit: Double) = apply { this.firstUnit = firstUnit } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + /** * Exclusive tier ending value. If null, this is treated as the last * tier */ - fun lastUnit(lastUnit: Double) = apply { this.lastUnit = lastUnit } + fun lastUnit(lastUnit: Double?) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { @@ -7591,10 +8096,10 @@ constructor( checkNotNull(firstUnit) { "`firstUnit` is required but was not set" }, - lastUnit, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + lastUnit, additionalProperties.toImmutable(), ) } @@ -7604,17 +8109,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -8045,59 +8550,61 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredConfig == other.tieredConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredConfig=$tieredConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_bps_config") + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -8105,9 +8612,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -8115,6 +8619,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -8126,17 +8646,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -8145,17 +8654,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_bps_config") - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -8170,141 +8675,222 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredBpsConfig: TieredBpsConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredBpsConfig: TieredBpsConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = apply { - metadata = newFloatingTieredBpsPrice.metadata - externalPriceId = newFloatingTieredBpsPrice.externalPriceId + cadence = newFloatingTieredBpsPrice.cadence + currency = newFloatingTieredBpsPrice.currency + itemId = newFloatingTieredBpsPrice.itemId + modelType = newFloatingTieredBpsPrice.modelType name = newFloatingTieredBpsPrice.name + tieredBpsConfig = newFloatingTieredBpsPrice.tieredBpsConfig billableMetricId = newFloatingTieredBpsPrice.billableMetricId - itemId = newFloatingTieredBpsPrice.itemId billedInAdvance = newFloatingTieredBpsPrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredBpsPrice.invoiceGroupingKey - cadence = newFloatingTieredBpsPrice.cadence billingCycleConfiguration = newFloatingTieredBpsPrice.billingCycleConfiguration + conversionRate = newFloatingTieredBpsPrice.conversionRate + externalPriceId = newFloatingTieredBpsPrice.externalPriceId + fixedPriceQuantity = newFloatingTieredBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredBpsPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredBpsPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredBpsPrice.conversionRate - modelType = newFloatingTieredBpsPrice.modelType - tieredBpsConfig = newFloatingTieredBpsPrice.tieredBpsConfig - currency = newFloatingTieredBpsPrice.currency + metadata = newFloatingTieredBpsPrice.metadata additionalProperties = newFloatingTieredBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { + this.tieredBpsConfig = tieredBpsConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are - * produced. If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** * The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { - this.tieredBpsConfig = tieredBpsConfig + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } fun removeAdditionalProperty(key: String) = apply { @@ -8317,23 +8903,23 @@ constructor( fun build(): NewFloatingTieredBpsPrice = NewFloatingTieredBpsPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredBpsConfig) { + "`tieredBpsConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredBpsConfig) { - "`tieredBpsConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -8559,15 +9145,18 @@ constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") private val bps: Double, @JsonProperty("minimum_amount") private val minimumAmount: String, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("bps") private val bps: Double, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + @JsonProperty("bps") fun bps(): Double = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount @@ -8575,9 +9164,6 @@ constructor( @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Per-event basis point rate */ - @JsonProperty("bps") fun bps(): Double = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -8595,40 +9181,48 @@ constructor( class Builder { + private var bps: Double? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var bps: Double? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8653,11 +9247,11 @@ constructor( fun build(): Tier = Tier( + checkNotNull(bps) { "`bps` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, maximumAmount, - checkNotNull(bps) { "`bps` is required but was not set" }, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -8668,17 +9262,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -9109,55 +9703,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredBpsConfig == other.tieredBpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredBpsPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredBpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredBpsConfig=$tieredBpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredBpsPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bps_config") private val bpsConfig: BpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bps_config") private val bpsConfig: BpsConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -9169,9 +9764,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -9179,6 +9771,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -9190,17 +9798,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -9209,16 +9806,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -9233,56 +9827,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bpsConfig: BpsConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bpsConfig: BpsConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingBpsPrice: NewFloatingBpsPrice) = apply { - metadata = newFloatingBpsPrice.metadata - externalPriceId = newFloatingBpsPrice.externalPriceId + bpsConfig = newFloatingBpsPrice.bpsConfig + cadence = newFloatingBpsPrice.cadence + currency = newFloatingBpsPrice.currency + itemId = newFloatingBpsPrice.itemId + modelType = newFloatingBpsPrice.modelType name = newFloatingBpsPrice.name billableMetricId = newFloatingBpsPrice.billableMetricId - itemId = newFloatingBpsPrice.itemId billedInAdvance = newFloatingBpsPrice.billedInAdvance + billingCycleConfiguration = newFloatingBpsPrice.billingCycleConfiguration + conversionRate = newFloatingBpsPrice.conversionRate + externalPriceId = newFloatingBpsPrice.externalPriceId fixedPriceQuantity = newFloatingBpsPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingBpsPrice.invoiceGroupingKey - cadence = newFloatingBpsPrice.cadence - billingCycleConfiguration = newFloatingBpsPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingBpsPrice.invoicingCycleConfiguration - conversionRate = newFloatingBpsPrice.conversionRate - modelType = newFloatingBpsPrice.modelType - bpsConfig = newFloatingBpsPrice.bpsConfig - currency = newFloatingBpsPrice.currency + metadata = newFloatingBpsPrice.metadata additionalProperties = newFloatingBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -9291,66 +9886,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are - * produced. If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** * The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9376,21 +10051,21 @@ constructor( fun build(): NewFloatingBpsPrice = NewFloatingBpsPrice( - metadata, - externalPriceId, + checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -9441,10 +10116,14 @@ constructor( fun bps(bps: Double) = apply { this.bps = bps } /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10037,55 +10716,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bpsConfig == other.bpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bpsConfig=$bpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -10097,9 +10777,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -10107,6 +10784,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -10118,17 +10811,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -10137,16 +10819,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -10161,58 +10840,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkBpsConfig: BulkBpsConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkBpsConfig: BulkBpsConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = apply { - metadata = newFloatingBulkBpsPrice.metadata - externalPriceId = newFloatingBulkBpsPrice.externalPriceId + bulkBpsConfig = newFloatingBulkBpsPrice.bulkBpsConfig + cadence = newFloatingBulkBpsPrice.cadence + currency = newFloatingBulkBpsPrice.currency + itemId = newFloatingBulkBpsPrice.itemId + modelType = newFloatingBulkBpsPrice.modelType name = newFloatingBulkBpsPrice.name billableMetricId = newFloatingBulkBpsPrice.billableMetricId - itemId = newFloatingBulkBpsPrice.itemId billedInAdvance = newFloatingBulkBpsPrice.billedInAdvance - fixedPriceQuantity = newFloatingBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkBpsPrice.invoiceGroupingKey - cadence = newFloatingBulkBpsPrice.cadence billingCycleConfiguration = newFloatingBulkBpsPrice.billingCycleConfiguration + conversionRate = newFloatingBulkBpsPrice.conversionRate + externalPriceId = newFloatingBulkBpsPrice.externalPriceId + fixedPriceQuantity = newFloatingBulkBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingBulkBpsPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingBulkBpsPrice.invoicingCycleConfiguration - conversionRate = newFloatingBulkBpsPrice.conversionRate - modelType = newFloatingBulkBpsPrice.modelType - bulkBpsConfig = newFloatingBulkBpsPrice.bulkBpsConfig - currency = newFloatingBulkBpsPrice.currency + metadata = newFloatingBulkBpsPrice.metadata additionalProperties = newFloatingBulkBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { + this.bulkBpsConfig = bulkBpsConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -10220,68 +10902,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) /** * For custom cadence: specifies the duration of the billing period in days or * months. */ fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration + billingCycleConfiguration: BillingCycleConfiguration? ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } /** - * Within each billing cycle, specifies the cadence at which invoices are - * produced. If unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) /** * The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = apply { + fun conversionRate(conversionRate: Double?) = apply { this.conversionRate = conversionRate } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { - this.bulkBpsConfig = bulkBpsConfig + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10307,23 +11067,23 @@ constructor( fun build(): NewFloatingBulkBpsPrice = NewFloatingBulkBpsPrice( - metadata, - externalPriceId, + checkNotNull(bulkBpsConfig) { + "`bulkBpsConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkBpsConfig) { - "`bulkBpsConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -10414,21 +11174,21 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("bps") private val bps: Double, + @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + @JsonProperty("bps") fun bps(): Double = bps + /** Upper bound for tier */ @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Basis points to rate on */ - @JsonProperty("bps") fun bps(): Double = bps - /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -10446,33 +11206,41 @@ constructor( class Builder { - private var maximumAmount: String? = null private var bps: Double? = null + private var maximumAmount: String? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10497,8 +11265,8 @@ constructor( fun build(): Tier = Tier( - maximumAmount, checkNotNull(bps) { "`bps` is required but was not set" }, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -10509,17 +11277,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -11084,55 +11852,56 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBulkBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkBpsConfig == other.bulkBpsConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkBpsConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBulkBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkBpsConfig=$bulkBpsConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -11144,9 +11913,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -11154,6 +11920,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -11165,17 +11947,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -11184,16 +11955,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -11208,56 +11976,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkConfig: BulkConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkConfig: BulkConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newFloatingBulkPrice: NewFloatingBulkPrice) = apply { - metadata = newFloatingBulkPrice.metadata - externalPriceId = newFloatingBulkPrice.externalPriceId + bulkConfig = newFloatingBulkPrice.bulkConfig + cadence = newFloatingBulkPrice.cadence + currency = newFloatingBulkPrice.currency + itemId = newFloatingBulkPrice.itemId + modelType = newFloatingBulkPrice.modelType name = newFloatingBulkPrice.name billableMetricId = newFloatingBulkPrice.billableMetricId - itemId = newFloatingBulkPrice.itemId billedInAdvance = newFloatingBulkPrice.billedInAdvance + billingCycleConfiguration = newFloatingBulkPrice.billingCycleConfiguration + conversionRate = newFloatingBulkPrice.conversionRate + externalPriceId = newFloatingBulkPrice.externalPriceId fixedPriceQuantity = newFloatingBulkPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingBulkPrice.invoiceGroupingKey - cadence = newFloatingBulkPrice.cadence - billingCycleConfiguration = newFloatingBulkPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingBulkPrice.invoicingCycleConfiguration - conversionRate = newFloatingBulkPrice.conversionRate - modelType = newFloatingBulkPrice.modelType - bulkConfig = newFloatingBulkPrice.bulkConfig - currency = newFloatingBulkPrice.currency + metadata = newFloatingBulkPrice.metadata additionalProperties = newFloatingBulkPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -11266,66 +12035,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11351,21 +12200,21 @@ constructor( fun build(): NewFloatingBulkPrice = NewFloatingBulkPrice( - metadata, - externalPriceId, + checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -11447,20 +12296,20 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Upper bound for this tier */ @JsonProperty("maximum_units") fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -11474,28 +12323,39 @@ constructor( class Builder { - private var maximumUnits: Double? = null private var unitAmount: String? = null + private var maximumUnits: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = apply { - this.maximumUnits = maximumUnits - } - /** Amount per unit */ fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double?) = apply { + this.maximumUnits = maximumUnits + } + + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(maximumUnits as Double?) + + /** Upper bound for this tier */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11520,10 +12380,10 @@ constructor( fun build(): Tier = Tier( - maximumUnits, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -11533,17 +12393,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -12108,60 +12968,63 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBulkPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkConfig == other.bulkConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBulkPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkConfig=$bulkConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("threshold_total_amount_config") + private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("threshold_total_amount_config") - private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("threshold_total_amount_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -12169,9 +13032,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -12179,6 +13039,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -12190,17 +13066,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -12209,18 +13074,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("threshold_total_amount_config") - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -12235,130 +13095,211 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice ) = apply { - metadata = newFloatingThresholdTotalAmountPrice.metadata - externalPriceId = newFloatingThresholdTotalAmountPrice.externalPriceId + cadence = newFloatingThresholdTotalAmountPrice.cadence + currency = newFloatingThresholdTotalAmountPrice.currency + itemId = newFloatingThresholdTotalAmountPrice.itemId + modelType = newFloatingThresholdTotalAmountPrice.modelType name = newFloatingThresholdTotalAmountPrice.name + thresholdTotalAmountConfig = + newFloatingThresholdTotalAmountPrice.thresholdTotalAmountConfig billableMetricId = newFloatingThresholdTotalAmountPrice.billableMetricId - itemId = newFloatingThresholdTotalAmountPrice.itemId billedInAdvance = newFloatingThresholdTotalAmountPrice.billedInAdvance - fixedPriceQuantity = newFloatingThresholdTotalAmountPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingThresholdTotalAmountPrice.invoiceGroupingKey - cadence = newFloatingThresholdTotalAmountPrice.cadence billingCycleConfiguration = newFloatingThresholdTotalAmountPrice.billingCycleConfiguration + conversionRate = newFloatingThresholdTotalAmountPrice.conversionRate + externalPriceId = newFloatingThresholdTotalAmountPrice.externalPriceId + fixedPriceQuantity = newFloatingThresholdTotalAmountPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingThresholdTotalAmountPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingThresholdTotalAmountPrice.invoicingCycleConfiguration - conversionRate = newFloatingThresholdTotalAmountPrice.conversionRate - modelType = newFloatingThresholdTotalAmountPrice.modelType - thresholdTotalAmountConfig = - newFloatingThresholdTotalAmountPrice.thresholdTotalAmountConfig - currency = newFloatingThresholdTotalAmountPrice.currency + metadata = newFloatingThresholdTotalAmountPrice.metadata additionalProperties = newFloatingThresholdTotalAmountPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: ThresholdTotalAmountConfig + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: ThresholdTotalAmountConfig - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12384,23 +13325,23 @@ constructor( fun build(): NewFloatingThresholdTotalAmountPrice = NewFloatingThresholdTotalAmountPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(thresholdTotalAmountConfig) { + "`thresholdTotalAmountConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(thresholdTotalAmountConfig) { - "`thresholdTotalAmountConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -13024,60 +13965,62 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingThresholdTotalAmountPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingThresholdTotalAmountPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, thresholdTotalAmountConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingThresholdTotalAmountPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingThresholdTotalAmountPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_config") + private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_config") - private val tieredPackageConfig: TieredPackageConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_config") + fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -13085,9 +14028,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -13095,6 +14035,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -13106,17 +14062,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -13125,17 +14070,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_config") - fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -13150,129 +14091,210 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageConfig: TieredPackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageConfig: TieredPackageConfig? = null - private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice ) = apply { - metadata = newFloatingTieredPackagePrice.metadata - externalPriceId = newFloatingTieredPackagePrice.externalPriceId + cadence = newFloatingTieredPackagePrice.cadence + currency = newFloatingTieredPackagePrice.currency + itemId = newFloatingTieredPackagePrice.itemId + modelType = newFloatingTieredPackagePrice.modelType name = newFloatingTieredPackagePrice.name + tieredPackageConfig = newFloatingTieredPackagePrice.tieredPackageConfig billableMetricId = newFloatingTieredPackagePrice.billableMetricId - itemId = newFloatingTieredPackagePrice.itemId billedInAdvance = newFloatingTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPackagePrice.invoiceGroupingKey - cadence = newFloatingTieredPackagePrice.cadence billingCycleConfiguration = newFloatingTieredPackagePrice.billingCycleConfiguration + conversionRate = newFloatingTieredPackagePrice.conversionRate + externalPriceId = newFloatingTieredPackagePrice.externalPriceId + fixedPriceQuantity = newFloatingTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredPackagePrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredPackagePrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredPackagePrice.conversionRate - modelType = newFloatingTieredPackagePrice.modelType - tieredPackageConfig = newFloatingTieredPackagePrice.tieredPackageConfig - currency = newFloatingTieredPackagePrice.currency + metadata = newFloatingTieredPackagePrice.metadata additionalProperties = newFloatingTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { + this.tieredPackageConfig = tieredPackageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { - this.tieredPackageConfig = tieredPackageConfig - } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -13298,23 +14320,23 @@ constructor( fun build(): NewFloatingTieredPackagePrice = NewFloatingTieredPackagePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredPackageConfig) { + "`tieredPackageConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredPackageConfig) { - "`tieredPackageConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -13937,56 +14959,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageConfig == other.tieredPackageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPackagePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageConfig=$tieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredPackagePrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_tiered_config") + private val groupedTieredConfig: GroupedTieredConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_tiered_config") - private val groupedTieredConfig: GroupedTieredConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_tiered_config") + fun groupedTieredConfig(): GroupedTieredConfig = groupedTieredConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -13998,9 +15022,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -14008,6 +15029,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -14019,17 +15056,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -14038,17 +15064,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_tiered_config") - fun groupedTieredConfig(): GroupedTieredConfig = groupedTieredConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -14063,60 +15085,63 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedTieredConfig: GroupedTieredConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedTieredConfig: GroupedTieredConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice ) = apply { - metadata = newFloatingGroupedTieredPrice.metadata - externalPriceId = newFloatingGroupedTieredPrice.externalPriceId + cadence = newFloatingGroupedTieredPrice.cadence + currency = newFloatingGroupedTieredPrice.currency + groupedTieredConfig = newFloatingGroupedTieredPrice.groupedTieredConfig + itemId = newFloatingGroupedTieredPrice.itemId + modelType = newFloatingGroupedTieredPrice.modelType name = newFloatingGroupedTieredPrice.name billableMetricId = newFloatingGroupedTieredPrice.billableMetricId - itemId = newFloatingGroupedTieredPrice.itemId billedInAdvance = newFloatingGroupedTieredPrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPrice.invoiceGroupingKey - cadence = newFloatingGroupedTieredPrice.cadence billingCycleConfiguration = newFloatingGroupedTieredPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedTieredPrice.conversionRate + externalPriceId = newFloatingGroupedTieredPrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedTieredPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedTieredPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedTieredPrice.conversionRate - modelType = newFloatingGroupedTieredPrice.modelType - groupedTieredConfig = newFloatingGroupedTieredPrice.groupedTieredConfig - currency = newFloatingGroupedTieredPrice.currency + metadata = newFloatingGroupedTieredPrice.metadata additionalProperties = newFloatingGroupedTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = apply { + this.groupedTieredConfig = groupedTieredConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -14124,68 +15149,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = apply { - this.groupedTieredConfig = groupedTieredConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -14211,23 +15314,23 @@ constructor( fun build(): NewFloatingGroupedTieredPrice = NewFloatingGroupedTieredPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedTieredConfig) { + "`groupedTieredConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedTieredConfig) { - "`groupedTieredConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -14850,60 +15953,62 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedTieredConfig == other.groupedTieredConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedTieredPrice && cadence == other.cadence && currency == other.currency && groupedTieredConfig == other.groupedTieredConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredConfig=$groupedTieredConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedTieredPrice{cadence=$cadence, currency=$currency, groupedTieredConfig=$groupedTieredConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_minimum_config") + private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_minimum_config") - private val tieredWithMinimumConfig: TieredWithMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_minimum_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -14911,9 +16016,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -14921,6 +16023,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -14932,17 +16050,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -14951,21 +16058,17 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_minimum_config") - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -14976,131 +16079,212 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice ) = apply { - metadata = newFloatingTieredWithMinimumPrice.metadata - externalPriceId = newFloatingTieredWithMinimumPrice.externalPriceId + cadence = newFloatingTieredWithMinimumPrice.cadence + currency = newFloatingTieredWithMinimumPrice.currency + itemId = newFloatingTieredWithMinimumPrice.itemId + modelType = newFloatingTieredWithMinimumPrice.modelType name = newFloatingTieredWithMinimumPrice.name + tieredWithMinimumConfig = + newFloatingTieredWithMinimumPrice.tieredWithMinimumConfig billableMetricId = newFloatingTieredWithMinimumPrice.billableMetricId - itemId = newFloatingTieredWithMinimumPrice.itemId billedInAdvance = newFloatingTieredWithMinimumPrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithMinimumPrice.invoiceGroupingKey - cadence = newFloatingTieredWithMinimumPrice.cadence billingCycleConfiguration = newFloatingTieredWithMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingTieredWithMinimumPrice.conversionRate + externalPriceId = newFloatingTieredWithMinimumPrice.externalPriceId + fixedPriceQuantity = newFloatingTieredWithMinimumPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredWithMinimumPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredWithMinimumPrice.conversionRate - modelType = newFloatingTieredWithMinimumPrice.modelType - tieredWithMinimumConfig = - newFloatingTieredWithMinimumPrice.tieredWithMinimumConfig - currency = newFloatingTieredWithMinimumPrice.currency + metadata = newFloatingTieredWithMinimumPrice.metadata additionalProperties = newFloatingTieredWithMinimumPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + apply { + this.tieredWithMinimumConfig = tieredWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - apply { - this.tieredWithMinimumConfig = tieredWithMinimumConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -15126,23 +16310,23 @@ constructor( fun build(): NewFloatingTieredWithMinimumPrice = NewFloatingTieredWithMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredWithMinimumConfig) { + "`tieredWithMinimumConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredWithMinimumConfig) { - "`tieredWithMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -15766,60 +16950,63 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredWithMinimumPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithMinimumConfig=$tieredWithMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredWithMinimumPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingPackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_with_allocation_config") + private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_with_allocation_config") - private val packageWithAllocationConfig: PackageWithAllocationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_with_allocation_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -15827,9 +17014,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -15837,6 +17021,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -15848,37 +17048,21 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. - * If unspecified, a single invoice is produced per billing cycle. + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. */ @JsonProperty("invoicing_cycle_configuration") fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_with_allocation_config") - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -15893,133 +17077,214 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageWithAllocationConfig: PackageWithAllocationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice ) = apply { - metadata = newFloatingPackageWithAllocationPrice.metadata - externalPriceId = newFloatingPackageWithAllocationPrice.externalPriceId + cadence = newFloatingPackageWithAllocationPrice.cadence + currency = newFloatingPackageWithAllocationPrice.currency + itemId = newFloatingPackageWithAllocationPrice.itemId + modelType = newFloatingPackageWithAllocationPrice.modelType name = newFloatingPackageWithAllocationPrice.name + packageWithAllocationConfig = + newFloatingPackageWithAllocationPrice.packageWithAllocationConfig billableMetricId = newFloatingPackageWithAllocationPrice.billableMetricId - itemId = newFloatingPackageWithAllocationPrice.itemId billedInAdvance = newFloatingPackageWithAllocationPrice.billedInAdvance + billingCycleConfiguration = + newFloatingPackageWithAllocationPrice.billingCycleConfiguration + conversionRate = newFloatingPackageWithAllocationPrice.conversionRate + externalPriceId = newFloatingPackageWithAllocationPrice.externalPriceId fixedPriceQuantity = newFloatingPackageWithAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingPackageWithAllocationPrice.invoiceGroupingKey - cadence = newFloatingPackageWithAllocationPrice.cadence - billingCycleConfiguration = - newFloatingPackageWithAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingPackageWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newFloatingPackageWithAllocationPrice.conversionRate - modelType = newFloatingPackageWithAllocationPrice.modelType - packageWithAllocationConfig = - newFloatingPackageWithAllocationPrice.packageWithAllocationConfig - currency = newFloatingPackageWithAllocationPrice.currency + metadata = newFloatingPackageWithAllocationPrice.metadata additionalProperties = newFloatingPackageWithAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16045,23 +17310,23 @@ constructor( fun build(): NewFloatingPackageWithAllocationPrice = NewFloatingPackageWithAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(packageWithAllocationConfig) { + "`packageWithAllocationConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(packageWithAllocationConfig) { - "`packageWithAllocationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -16686,60 +17951,63 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingPackageWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageWithAllocationConfig == other.packageWithAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingPackageWithAllocationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageWithAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingPackageWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageWithAllocationConfig=$packageWithAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingPackageWithAllocationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredPackageWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_with_minimum_config") + private val tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_with_minimum_config") - private val tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_with_minimum_config") + fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = + tieredPackageWithMinimumConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -16747,9 +18015,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -16758,26 +18023,31 @@ constructor( fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) /** - * If the Price represents a fixed cost, this represents the quantity of units - * applied. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - @JsonProperty("fixed_price_quantity") - fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * If the Price represents a fixed cost, this represents the quantity of units + * applied. */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) + @JsonProperty("fixed_price_quantity") + fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) /** * Within each billing cycle, specifies the cadence at which invoices are produced. @@ -16787,18 +18057,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_with_minimum_config") - fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = - tieredPackageWithMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -16813,22 +18078,22 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig? = + null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig? = - null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -16836,114 +18101,195 @@ constructor( newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice ) = apply { - metadata = newFloatingTieredPackageWithMinimumPrice.metadata - externalPriceId = newFloatingTieredPackageWithMinimumPrice.externalPriceId + cadence = newFloatingTieredPackageWithMinimumPrice.cadence + currency = newFloatingTieredPackageWithMinimumPrice.currency + itemId = newFloatingTieredPackageWithMinimumPrice.itemId + modelType = newFloatingTieredPackageWithMinimumPrice.modelType name = newFloatingTieredPackageWithMinimumPrice.name + tieredPackageWithMinimumConfig = + newFloatingTieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig billableMetricId = newFloatingTieredPackageWithMinimumPrice.billableMetricId - itemId = newFloatingTieredPackageWithMinimumPrice.itemId billedInAdvance = newFloatingTieredPackageWithMinimumPrice.billedInAdvance + billingCycleConfiguration = + newFloatingTieredPackageWithMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingTieredPackageWithMinimumPrice.conversionRate + externalPriceId = newFloatingTieredPackageWithMinimumPrice.externalPriceId fixedPriceQuantity = newFloatingTieredPackageWithMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingTieredPackageWithMinimumPrice.invoiceGroupingKey - cadence = newFloatingTieredPackageWithMinimumPrice.cadence - billingCycleConfiguration = - newFloatingTieredPackageWithMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingTieredPackageWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredPackageWithMinimumPrice.conversionRate - modelType = newFloatingTieredPackageWithMinimumPrice.modelType - tieredPackageWithMinimumConfig = - newFloatingTieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig - currency = newFloatingTieredPackageWithMinimumPrice.currency + metadata = newFloatingTieredPackageWithMinimumPrice.metadata additionalProperties = newFloatingTieredPackageWithMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageWithMinimumConfig( + tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig + ) = apply { + this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredPackageWithMinimumConfig( - tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig - ) = apply { - this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16969,23 +18315,23 @@ constructor( fun build(): NewFloatingTieredPackageWithMinimumPrice = NewFloatingTieredPackageWithMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredPackageWithMinimumConfig) { + "`tieredPackageWithMinimumConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredPackageWithMinimumConfig) { - "`tieredPackageWithMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -17611,60 +18957,62 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredPackageWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPackageWithMinimumPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageWithMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredPackageWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredPackageWithMinimumPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingUnitWithPercentPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_percent_config") + private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_percent_config") - private val unitWithPercentConfig: UnitWithPercentConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_percent_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -17672,9 +19020,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -17682,6 +19027,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -17693,17 +19054,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -17712,17 +19062,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_percent_config") - fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -17737,131 +19083,212 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithPercentConfig: UnitWithPercentConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithPercentConfig: UnitWithPercentConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice ) = apply { - metadata = newFloatingUnitWithPercentPrice.metadata - externalPriceId = newFloatingUnitWithPercentPrice.externalPriceId + cadence = newFloatingUnitWithPercentPrice.cadence + currency = newFloatingUnitWithPercentPrice.currency + itemId = newFloatingUnitWithPercentPrice.itemId + modelType = newFloatingUnitWithPercentPrice.modelType name = newFloatingUnitWithPercentPrice.name + unitWithPercentConfig = + newFloatingUnitWithPercentPrice.unitWithPercentConfig billableMetricId = newFloatingUnitWithPercentPrice.billableMetricId - itemId = newFloatingUnitWithPercentPrice.itemId billedInAdvance = newFloatingUnitWithPercentPrice.billedInAdvance - fixedPriceQuantity = newFloatingUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithPercentPrice.invoiceGroupingKey - cadence = newFloatingUnitWithPercentPrice.cadence billingCycleConfiguration = newFloatingUnitWithPercentPrice.billingCycleConfiguration + conversionRate = newFloatingUnitWithPercentPrice.conversionRate + externalPriceId = newFloatingUnitWithPercentPrice.externalPriceId + fixedPriceQuantity = newFloatingUnitWithPercentPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingUnitWithPercentPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingUnitWithPercentPrice.invoicingCycleConfiguration - conversionRate = newFloatingUnitWithPercentPrice.conversionRate - modelType = newFloatingUnitWithPercentPrice.modelType - unitWithPercentConfig = - newFloatingUnitWithPercentPrice.unitWithPercentConfig - currency = newFloatingUnitWithPercentPrice.currency + metadata = newFloatingUnitWithPercentPrice.metadata additionalProperties = newFloatingUnitWithPercentPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = + apply { + this.unitWithPercentConfig = unitWithPercentConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = - apply { - this.unitWithPercentConfig = unitWithPercentConfig - } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -17887,23 +19314,23 @@ constructor( fun build(): NewFloatingUnitWithPercentPrice = NewFloatingUnitWithPercentPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitWithPercentConfig) { + "`unitWithPercentConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitWithPercentConfig) { - "`unitWithPercentConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -18526,60 +19953,63 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingUnitWithPercentPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithPercentConfig == other.unitWithPercentConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingUnitWithPercentPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithPercentConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingUnitWithPercentPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithPercentConfig=$unitWithPercentConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingUnitWithPercentPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingTieredWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_proration_config") + private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_proration_config") - private val tieredWithProrationConfig: TieredWithProrationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_proration_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -18587,9 +20017,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -18597,6 +20024,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -18608,17 +20051,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -18627,18 +20059,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_proration_config") - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -18653,130 +20080,211 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithProrationConfig: TieredWithProrationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice ) = apply { - metadata = newFloatingTieredWithProrationPrice.metadata - externalPriceId = newFloatingTieredWithProrationPrice.externalPriceId + cadence = newFloatingTieredWithProrationPrice.cadence + currency = newFloatingTieredWithProrationPrice.currency + itemId = newFloatingTieredWithProrationPrice.itemId + modelType = newFloatingTieredWithProrationPrice.modelType name = newFloatingTieredWithProrationPrice.name + tieredWithProrationConfig = + newFloatingTieredWithProrationPrice.tieredWithProrationConfig billableMetricId = newFloatingTieredWithProrationPrice.billableMetricId - itemId = newFloatingTieredWithProrationPrice.itemId billedInAdvance = newFloatingTieredWithProrationPrice.billedInAdvance - fixedPriceQuantity = newFloatingTieredWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredWithProrationPrice.invoiceGroupingKey - cadence = newFloatingTieredWithProrationPrice.cadence billingCycleConfiguration = newFloatingTieredWithProrationPrice.billingCycleConfiguration + conversionRate = newFloatingTieredWithProrationPrice.conversionRate + externalPriceId = newFloatingTieredWithProrationPrice.externalPriceId + fixedPriceQuantity = newFloatingTieredWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingTieredWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingTieredWithProrationPrice.invoicingCycleConfiguration - conversionRate = newFloatingTieredWithProrationPrice.conversionRate - modelType = newFloatingTieredWithProrationPrice.modelType - tieredWithProrationConfig = - newFloatingTieredWithProrationPrice.tieredWithProrationConfig - currency = newFloatingTieredWithProrationPrice.currency + metadata = newFloatingTieredWithProrationPrice.metadata additionalProperties = newFloatingTieredWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithProrationConfig( + tieredWithProrationConfig: TieredWithProrationConfig + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredWithProrationConfig( - tieredWithProrationConfig: TieredWithProrationConfig - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -18802,23 +20310,23 @@ constructor( fun build(): NewFloatingTieredWithProrationPrice = NewFloatingTieredWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(tieredWithProrationConfig) { + "`tieredWithProrationConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(tieredWithProrationConfig) { - "`tieredWithProrationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -19442,60 +20950,62 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingTieredWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithProrationConfig == other.tieredWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredWithProrationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingTieredWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithProrationConfig=$tieredWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingTieredWithProrationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingUnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_proration_config") + private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_proration_config") - private val unitWithProrationConfig: UnitWithProrationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -19503,9 +21013,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -19513,6 +21020,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -19524,17 +21047,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -19543,17 +21055,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_proration_config") - fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -19568,131 +21076,212 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithProrationConfig: UnitWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithProrationConfig: UnitWithProrationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice ) = apply { - metadata = newFloatingUnitWithProrationPrice.metadata - externalPriceId = newFloatingUnitWithProrationPrice.externalPriceId + cadence = newFloatingUnitWithProrationPrice.cadence + currency = newFloatingUnitWithProrationPrice.currency + itemId = newFloatingUnitWithProrationPrice.itemId + modelType = newFloatingUnitWithProrationPrice.modelType name = newFloatingUnitWithProrationPrice.name + unitWithProrationConfig = + newFloatingUnitWithProrationPrice.unitWithProrationConfig billableMetricId = newFloatingUnitWithProrationPrice.billableMetricId - itemId = newFloatingUnitWithProrationPrice.itemId billedInAdvance = newFloatingUnitWithProrationPrice.billedInAdvance - fixedPriceQuantity = newFloatingUnitWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingUnitWithProrationPrice.invoiceGroupingKey - cadence = newFloatingUnitWithProrationPrice.cadence billingCycleConfiguration = newFloatingUnitWithProrationPrice.billingCycleConfiguration + conversionRate = newFloatingUnitWithProrationPrice.conversionRate + externalPriceId = newFloatingUnitWithProrationPrice.externalPriceId + fixedPriceQuantity = newFloatingUnitWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingUnitWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingUnitWithProrationPrice.invoicingCycleConfiguration - conversionRate = newFloatingUnitWithProrationPrice.conversionRate - modelType = newFloatingUnitWithProrationPrice.modelType - unitWithProrationConfig = - newFloatingUnitWithProrationPrice.unitWithProrationConfig - currency = newFloatingUnitWithProrationPrice.currency + metadata = newFloatingUnitWithProrationPrice.metadata additionalProperties = newFloatingUnitWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + apply { + this.unitWithProrationConfig = unitWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - apply { - this.unitWithProrationConfig = unitWithProrationConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19718,23 +21307,23 @@ constructor( fun build(): NewFloatingUnitWithProrationPrice = NewFloatingUnitWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitWithProrationConfig) { + "`unitWithProrationConfig` is required but was not set" + }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitWithProrationConfig) { - "`unitWithProrationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -20358,56 +21947,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingUnitWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithProrationConfig == other.unitWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingUnitWithProrationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingUnitWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithProrationConfig=$unitWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingUnitWithProrationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_allocation_config") + private val groupedAllocationConfig: GroupedAllocationConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_allocation_config") - private val groupedAllocationConfig: GroupedAllocationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_allocation_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -20419,9 +22010,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -20429,6 +22017,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -20440,17 +22044,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -20459,17 +22052,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_allocation_config") - fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -20484,60 +22073,64 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedAllocationConfig: GroupedAllocationConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedAllocationConfig: GroupedAllocationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice ) = apply { - metadata = newFloatingGroupedAllocationPrice.metadata - externalPriceId = newFloatingGroupedAllocationPrice.externalPriceId + cadence = newFloatingGroupedAllocationPrice.cadence + currency = newFloatingGroupedAllocationPrice.currency + groupedAllocationConfig = + newFloatingGroupedAllocationPrice.groupedAllocationConfig + itemId = newFloatingGroupedAllocationPrice.itemId + modelType = newFloatingGroupedAllocationPrice.modelType name = newFloatingGroupedAllocationPrice.name billableMetricId = newFloatingGroupedAllocationPrice.billableMetricId - itemId = newFloatingGroupedAllocationPrice.itemId billedInAdvance = newFloatingGroupedAllocationPrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedAllocationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedAllocationPrice.invoiceGroupingKey - cadence = newFloatingGroupedAllocationPrice.cadence billingCycleConfiguration = newFloatingGroupedAllocationPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedAllocationPrice.conversionRate + externalPriceId = newFloatingGroupedAllocationPrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedAllocationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedAllocationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedAllocationPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedAllocationPrice.conversionRate - modelType = newFloatingGroupedAllocationPrice.modelType - groupedAllocationConfig = - newFloatingGroupedAllocationPrice.groupedAllocationConfig - currency = newFloatingGroupedAllocationPrice.currency + metadata = newFloatingGroupedAllocationPrice.metadata additionalProperties = newFloatingGroupedAllocationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + apply { + this.groupedAllocationConfig = groupedAllocationConfig + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -20546,69 +22139,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - apply { - this.groupedAllocationConfig = groupedAllocationConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20634,23 +22304,23 @@ constructor( fun build(): NewFloatingGroupedAllocationPrice = NewFloatingGroupedAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedAllocationConfig) { + "`groupedAllocationConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedAllocationConfig) { - "`groupedAllocationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -21274,56 +22944,59 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedAllocationConfig == other.groupedAllocationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedAllocationPrice && cadence == other.cadence && currency == other.currency && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedAllocationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedAllocationConfig=$groupedAllocationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedAllocationPrice{cadence=$cadence, currency=$currency, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_with_prorated_minimum_config") + private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_prorated_minimum_config") - private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_with_prorated_minimum_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -21335,9 +23008,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -21345,6 +23015,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -21356,17 +23042,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -21375,18 +23050,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_prorated_minimum_config") - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -21401,23 +23071,23 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedWithProratedMinimumConfig: + GroupedWithProratedMinimumConfig? = + null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithProratedMinimumConfig: - GroupedWithProratedMinimumConfig? = - null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -21425,45 +23095,50 @@ constructor( newFloatingGroupedWithProratedMinimumPrice: NewFloatingGroupedWithProratedMinimumPrice ) = apply { - metadata = newFloatingGroupedWithProratedMinimumPrice.metadata - externalPriceId = newFloatingGroupedWithProratedMinimumPrice.externalPriceId + cadence = newFloatingGroupedWithProratedMinimumPrice.cadence + currency = newFloatingGroupedWithProratedMinimumPrice.currency + groupedWithProratedMinimumConfig = + newFloatingGroupedWithProratedMinimumPrice + .groupedWithProratedMinimumConfig + itemId = newFloatingGroupedWithProratedMinimumPrice.itemId + modelType = newFloatingGroupedWithProratedMinimumPrice.modelType name = newFloatingGroupedWithProratedMinimumPrice.name billableMetricId = newFloatingGroupedWithProratedMinimumPrice.billableMetricId - itemId = newFloatingGroupedWithProratedMinimumPrice.itemId billedInAdvance = newFloatingGroupedWithProratedMinimumPrice.billedInAdvance + billingCycleConfiguration = + newFloatingGroupedWithProratedMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedWithProratedMinimumPrice.conversionRate + externalPriceId = newFloatingGroupedWithProratedMinimumPrice.externalPriceId fixedPriceQuantity = newFloatingGroupedWithProratedMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingGroupedWithProratedMinimumPrice.invoiceGroupingKey - cadence = newFloatingGroupedWithProratedMinimumPrice.cadence - billingCycleConfiguration = - newFloatingGroupedWithProratedMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingGroupedWithProratedMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedWithProratedMinimumPrice.conversionRate - modelType = newFloatingGroupedWithProratedMinimumPrice.modelType - groupedWithProratedMinimumConfig = - newFloatingGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - currency = newFloatingGroupedWithProratedMinimumPrice.currency + metadata = newFloatingGroupedWithProratedMinimumPrice.metadata additionalProperties = newFloatingGroupedWithProratedMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -21471,70 +23146,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { - this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -21560,23 +23311,23 @@ constructor( fun build(): NewFloatingGroupedWithProratedMinimumPrice = NewFloatingGroupedWithProratedMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedWithProratedMinimumConfig) { + "`groupedWithProratedMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithProratedMinimumConfig) { - "`groupedWithProratedMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -22202,56 +23953,59 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedWithProratedMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedWithProratedMinimumPrice && cadence == other.cadence && currency == other.currency && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithProratedMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedWithProratedMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedWithProratedMinimumPrice{cadence=$cadence, currency=$currency, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedWithMeteredMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_with_metered_minimum_config") + private val groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_metered_minimum_config") - private val groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_with_metered_minimum_config") + fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -22263,9 +24017,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -22273,6 +24024,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -22284,17 +24051,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -22303,18 +24059,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_metered_minimum_config") - fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -22329,22 +24080,22 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig? = + null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig? = - null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -22352,45 +24103,50 @@ constructor( newFloatingGroupedWithMeteredMinimumPrice: NewFloatingGroupedWithMeteredMinimumPrice ) = apply { - metadata = newFloatingGroupedWithMeteredMinimumPrice.metadata - externalPriceId = newFloatingGroupedWithMeteredMinimumPrice.externalPriceId + cadence = newFloatingGroupedWithMeteredMinimumPrice.cadence + currency = newFloatingGroupedWithMeteredMinimumPrice.currency + groupedWithMeteredMinimumConfig = + newFloatingGroupedWithMeteredMinimumPrice + .groupedWithMeteredMinimumConfig + itemId = newFloatingGroupedWithMeteredMinimumPrice.itemId + modelType = newFloatingGroupedWithMeteredMinimumPrice.modelType name = newFloatingGroupedWithMeteredMinimumPrice.name billableMetricId = newFloatingGroupedWithMeteredMinimumPrice.billableMetricId - itemId = newFloatingGroupedWithMeteredMinimumPrice.itemId billedInAdvance = newFloatingGroupedWithMeteredMinimumPrice.billedInAdvance + billingCycleConfiguration = + newFloatingGroupedWithMeteredMinimumPrice.billingCycleConfiguration + conversionRate = newFloatingGroupedWithMeteredMinimumPrice.conversionRate + externalPriceId = newFloatingGroupedWithMeteredMinimumPrice.externalPriceId fixedPriceQuantity = newFloatingGroupedWithMeteredMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newFloatingGroupedWithMeteredMinimumPrice.invoiceGroupingKey - cadence = newFloatingGroupedWithMeteredMinimumPrice.cadence - billingCycleConfiguration = - newFloatingGroupedWithMeteredMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedWithMeteredMinimumPrice.conversionRate - modelType = newFloatingGroupedWithMeteredMinimumPrice.modelType - groupedWithMeteredMinimumConfig = - newFloatingGroupedWithMeteredMinimumPrice - .groupedWithMeteredMinimumConfig - currency = newFloatingGroupedWithMeteredMinimumPrice.currency + metadata = newFloatingGroupedWithMeteredMinimumPrice.metadata additionalProperties = newFloatingGroupedWithMeteredMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = apply { + this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -22398,70 +24154,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = apply { - this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22487,23 +24319,23 @@ constructor( fun build(): NewFloatingGroupedWithMeteredMinimumPrice = NewFloatingGroupedWithMeteredMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedWithMeteredMinimumConfig) { + "`groupedWithMeteredMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithMeteredMinimumConfig) { - "`groupedWithMeteredMinimumConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -23129,56 +24961,59 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedWithMeteredMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedWithMeteredMinimumPrice && cadence == other.cadence && currency == other.currency && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithMeteredMinimumConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithMeteredMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedWithMeteredMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedWithMeteredMinimumPrice{cadence=$cadence, currency=$currency, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingMatrixWithDisplayNamePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_with_display_name_config") + private val matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_with_display_name_config") - private val matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_with_display_name_config") + fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = + matrixWithDisplayNameConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -23190,9 +25025,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -23200,6 +25032,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -23211,17 +25059,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -23230,18 +25067,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_with_display_name_config") - fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = - matrixWithDisplayNameConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -23256,63 +25088,66 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice ) = apply { - metadata = newFloatingMatrixWithDisplayNamePrice.metadata - externalPriceId = newFloatingMatrixWithDisplayNamePrice.externalPriceId + cadence = newFloatingMatrixWithDisplayNamePrice.cadence + currency = newFloatingMatrixWithDisplayNamePrice.currency + itemId = newFloatingMatrixWithDisplayNamePrice.itemId + matrixWithDisplayNameConfig = + newFloatingMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig + modelType = newFloatingMatrixWithDisplayNamePrice.modelType name = newFloatingMatrixWithDisplayNamePrice.name billableMetricId = newFloatingMatrixWithDisplayNamePrice.billableMetricId - itemId = newFloatingMatrixWithDisplayNamePrice.itemId billedInAdvance = newFloatingMatrixWithDisplayNamePrice.billedInAdvance + billingCycleConfiguration = + newFloatingMatrixWithDisplayNamePrice.billingCycleConfiguration + conversionRate = newFloatingMatrixWithDisplayNamePrice.conversionRate + externalPriceId = newFloatingMatrixWithDisplayNamePrice.externalPriceId fixedPriceQuantity = newFloatingMatrixWithDisplayNamePrice.fixedPriceQuantity invoiceGroupingKey = newFloatingMatrixWithDisplayNamePrice.invoiceGroupingKey - cadence = newFloatingMatrixWithDisplayNamePrice.cadence - billingCycleConfiguration = - newFloatingMatrixWithDisplayNamePrice.billingCycleConfiguration invoicingCycleConfiguration = newFloatingMatrixWithDisplayNamePrice.invoicingCycleConfiguration - conversionRate = newFloatingMatrixWithDisplayNamePrice.conversionRate - modelType = newFloatingMatrixWithDisplayNamePrice.modelType - matrixWithDisplayNameConfig = - newFloatingMatrixWithDisplayNamePrice.matrixWithDisplayNameConfig - currency = newFloatingMatrixWithDisplayNamePrice.currency + metadata = newFloatingMatrixWithDisplayNamePrice.metadata additionalProperties = newFloatingMatrixWithDisplayNamePrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig + ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -23321,68 +25156,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig - ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23408,23 +25321,23 @@ constructor( fun build(): NewFloatingMatrixWithDisplayNamePrice = NewFloatingMatrixWithDisplayNamePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixWithDisplayNameConfig) { + "`matrixWithDisplayNameConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixWithDisplayNameConfig) { - "`matrixWithDisplayNameConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -24049,56 +25962,58 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingMatrixWithDisplayNamePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingMatrixWithDisplayNamePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixWithDisplayNameConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithDisplayNameConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingMatrixWithDisplayNamePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingMatrixWithDisplayNamePrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingBulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_with_proration_config") + private val bulkWithProrationConfig: BulkWithProrationConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_with_proration_config") - private val bulkWithProrationConfig: BulkWithProrationConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_with_proration_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -24110,9 +26025,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -24120,6 +26032,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -24131,17 +26059,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -24150,17 +26067,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_with_proration_config") - fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -24175,60 +26088,64 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkWithProrationConfig: BulkWithProrationConfig? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkWithProrationConfig: BulkWithProrationConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice ) = apply { - metadata = newFloatingBulkWithProrationPrice.metadata - externalPriceId = newFloatingBulkWithProrationPrice.externalPriceId + bulkWithProrationConfig = + newFloatingBulkWithProrationPrice.bulkWithProrationConfig + cadence = newFloatingBulkWithProrationPrice.cadence + currency = newFloatingBulkWithProrationPrice.currency + itemId = newFloatingBulkWithProrationPrice.itemId + modelType = newFloatingBulkWithProrationPrice.modelType name = newFloatingBulkWithProrationPrice.name billableMetricId = newFloatingBulkWithProrationPrice.billableMetricId - itemId = newFloatingBulkWithProrationPrice.itemId billedInAdvance = newFloatingBulkWithProrationPrice.billedInAdvance - fixedPriceQuantity = newFloatingBulkWithProrationPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingBulkWithProrationPrice.invoiceGroupingKey - cadence = newFloatingBulkWithProrationPrice.cadence billingCycleConfiguration = newFloatingBulkWithProrationPrice.billingCycleConfiguration + conversionRate = newFloatingBulkWithProrationPrice.conversionRate + externalPriceId = newFloatingBulkWithProrationPrice.externalPriceId + fixedPriceQuantity = newFloatingBulkWithProrationPrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingBulkWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingBulkWithProrationPrice.invoicingCycleConfiguration - conversionRate = newFloatingBulkWithProrationPrice.conversionRate - modelType = newFloatingBulkWithProrationPrice.modelType - bulkWithProrationConfig = - newFloatingBulkWithProrationPrice.bulkWithProrationConfig - currency = newFloatingBulkWithProrationPrice.currency + metadata = newFloatingBulkWithProrationPrice.metadata additionalProperties = newFloatingBulkWithProrationPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + apply { + this.bulkWithProrationConfig = bulkWithProrationConfig + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -24237,69 +26154,146 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * User-specified key/value pairs for the resource. 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?) = apply { this.metadata = metadata } /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - apply { - this.bulkWithProrationConfig = bulkWithProrationConfig - } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -24325,23 +26319,23 @@ constructor( fun build(): NewFloatingBulkWithProrationPrice = NewFloatingBulkWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(bulkWithProrationConfig) { + "`bulkWithProrationConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkWithProrationConfig) { - "`bulkWithProrationConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -24965,56 +26959,59 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingBulkWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkWithProrationConfig == other.bulkWithProrationConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkWithProrationConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewFloatingGroupedTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("currency") private val currency: String, + @JsonProperty("grouped_tiered_package_config") + private val groupedTieredPackageConfig: GroupedTieredPackageConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, + @JsonProperty("conversion_rate") private val conversionRate: Double?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, @JsonProperty("invoicing_cycle_configuration") private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, - @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_tiered_package_config") - private val groupedTieredPackageConfig: GroupedTieredPackageConfig, - @JsonProperty("currency") private val currency: String, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String = currency + + @JsonProperty("grouped_tiered_package_config") + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -25026,9 +27023,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -25036,6 +27030,22 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -25047,17 +27057,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -25066,18 +27065,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_tiered_package_config") - fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = - groupedTieredPackageConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") fun currency(): String = currency + /** + * User-specified key/value pairs for the resource. 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") + fun metadata(): Optional = Optional.ofNullable(metadata) @JsonAnyGetter @ExcludeMissing @@ -25092,130 +27086,211 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var currency: String? = null + private var groupedTieredPackageConfig: GroupedTieredPackageConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var conversionRate: Double? = null + private var externalPriceId: String? = null private var fixedPriceQuantity: Double? = null private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null - private var billingCycleConfiguration: BillingCycleConfiguration? = null private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null - private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedTieredPackageConfig: GroupedTieredPackageConfig? = null - private var currency: String? = null + private var metadata: Metadata? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice ) = apply { - metadata = newFloatingGroupedTieredPackagePrice.metadata - externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId + cadence = newFloatingGroupedTieredPackagePrice.cadence + currency = newFloatingGroupedTieredPackagePrice.currency + groupedTieredPackageConfig = + newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig + itemId = newFloatingGroupedTieredPackagePrice.itemId + modelType = newFloatingGroupedTieredPackagePrice.modelType name = newFloatingGroupedTieredPackagePrice.name billableMetricId = newFloatingGroupedTieredPackagePrice.billableMetricId - itemId = newFloatingGroupedTieredPackagePrice.itemId billedInAdvance = newFloatingGroupedTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newFloatingGroupedTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingGroupedTieredPackagePrice.invoiceGroupingKey - cadence = newFloatingGroupedTieredPackagePrice.cadence billingCycleConfiguration = newFloatingGroupedTieredPackagePrice.billingCycleConfiguration + conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate + externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId + fixedPriceQuantity = newFloatingGroupedTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newFloatingGroupedTieredPackagePrice.invoiceGroupingKey invoicingCycleConfiguration = newFloatingGroupedTieredPackagePrice.invoicingCycleConfiguration - conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate - modelType = newFloatingGroupedTieredPackagePrice.modelType - groupedTieredPackageConfig = - newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig - currency = newFloatingGroupedTieredPackagePrice.currency + metadata = newFloatingGroupedTieredPackagePrice.metadata additionalProperties = newFloatingGroupedTieredPackagePrice.additionalProperties.toMutableMap() } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = apply { this.currency = currency } + + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: GroupedTieredPackageConfig + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + + /** The name of the price. */ + fun name(name: String) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = apply { + this.billableMetricId = billableMetricId + } + /** - * User-specified key/value pairs for the resource. Individual keys can be - * removed by setting the value to `null`, and the entire metadata mapping can - * be cleared by setting `metadata` to `null`. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } - /** The name of the price. */ - fun name(name: String) = apply { this.name = name } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) /** - * The id of the billable metric for the price. Only needed if the price is - * usage-based. + * If the Price represents a fixed cost, this represents the quantity of units + * applied. */ - fun billableMetricId(billableMetricId: String) = apply { - this.billableMetricId = billableMetricId + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if - * this is true, and in-arrears if this is false. + * If the Price represents a fixed cost, this represents the quantity of units + * applied. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { - this.billedInAdvance = billedInAdvance - } + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedTieredPackageConfig( - groupedTieredPackageConfig: GroupedTieredPackageConfig - ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = apply { this.currency = currency } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -25241,23 +27316,23 @@ constructor( fun build(): NewFloatingGroupedTieredPackagePrice = NewFloatingGroupedTieredPackagePrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + checkNotNull(groupedTieredPackageConfig) { + "`groupedTieredPackageConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, fixedPriceQuantity, invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, invoicingCycleConfiguration, - conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedTieredPackageConfig) { - "`groupedTieredPackageConfig` is required but was not set" - }, - checkNotNull(currency) { "`currency` is required but was not set" }, + metadata, additionalProperties.toImmutable(), ) } @@ -25881,17 +27956,17 @@ constructor( return true } - return /* spotless:off */ other is NewFloatingGroupedTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedTieredPackageConfig == other.groupedTieredPackageConfig && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedTieredPackagePrice && cadence == other.cadence && currency == other.currency && groupedTieredPackageConfig == other.groupedTieredPackageConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredPackageConfig, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredPackageConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewFloatingGroupedTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredPackageConfig=$groupedTieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + "NewFloatingGroupedTieredPackagePrice{cadence=$cadence, currency=$currency, groupedTieredPackageConfig=$groupedTieredPackageConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } } @@ -25900,17 +27975,17 @@ constructor( return true } - return /* spotless:off */ other is Add && priceId == other.priceId && externalPriceId == other.externalPriceId && price == other.price && allocationPrice == other.allocationPrice && startDate == other.startDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && discounts == other.discounts && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Add && startDate == other.startDate && allocationPrice == other.allocationPrice && discounts == other.discounts && endDate == other.endDate && externalPriceId == other.externalPriceId && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, externalPriceId, price, allocationPrice, startDate, endDate, fixedFeeQuantityTransitions, discounts, minimumAmount, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(startDate, allocationPrice, discounts, endDate, externalPriceId, fixedFeeQuantityTransitions, maximumAmount, minimumAmount, price, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Add{priceId=$priceId, externalPriceId=$externalPriceId, price=$price, allocationPrice=$allocationPrice, startDate=$startDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, discounts=$discounts, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "Add{startDate=$startDate, allocationPrice=$allocationPrice, discounts=$discounts, endDate=$endDate, externalPriceId=$externalPriceId, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -26006,7 +28081,13 @@ constructor( * The end date of the adjustment interval. This is the date that the adjustment will * stop affecting prices on the subscription. */ - fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + fun endDate(endDate: EndDate?) = apply { this.endDate = endDate } + + /** + * The end date of the adjustment interval. This is the date that the adjustment will + * stop affecting prices on the subscription. + */ + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) fun endDate(dateTime: OffsetDateTime) = apply { this.endDate = EndDate.ofDateTime(dateTime) @@ -26232,18 +28313,24 @@ constructor( class NewPercentageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("percentage_discount") private val percentageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("percentage_discount") + fun percentageDiscount(): Double = percentageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -26251,12 +28338,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("percentage_discount") - fun percentageDiscount(): Double = percentageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26270,22 +28351,26 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var percentageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel adjustmentType = newPercentageDiscount.adjustmentType + appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() percentageDiscount = newPercentageDiscount.percentageDiscount + isInvoiceLevel = newPercentageDiscount.isInvoiceLevel additionalProperties = newPercentageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -26297,21 +28382,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun percentageDiscount(percentageDiscount: Double) = apply { + this.percentageDiscount = percentageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun percentageDiscount(percentageDiscount: Double) = apply { - this.percentageDiscount = percentageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26337,17 +28433,17 @@ constructor( fun build(): NewPercentageDiscount = NewPercentageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(percentageDiscount) { "`percentageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -26409,35 +28505,40 @@ constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, percentageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewUsageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("usage_discount") private val usageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -26445,11 +28546,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26463,21 +28559,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var usageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newUsageDiscount.isInvoiceLevel adjustmentType = newUsageDiscount.adjustmentType + appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() usageDiscount = newUsageDiscount.usageDiscount + isInvoiceLevel = newUsageDiscount.isInvoiceLevel additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -26489,21 +28589,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun usageDiscount(usageDiscount: Double) = apply { + this.usageDiscount = usageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun usageDiscount(usageDiscount: Double) = apply { - this.usageDiscount = usageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26529,17 +28640,17 @@ constructor( fun build(): NewUsageDiscount = NewUsageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(usageDiscount) { "`usageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -26601,31 +28712,36 @@ constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, usageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewAmountDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, @JsonProperty("amount_discount") private val amountDiscount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + + @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds @@ -26637,11 +28753,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26655,21 +28766,29 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null + private var appliesToPriceIds: MutableList? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newAmountDiscount.isInvoiceLevel adjustmentType = newAmountDiscount.adjustmentType amountDiscount = newAmountDiscount.amountDiscount + appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() + isInvoiceLevel = newAmountDiscount.isInvoiceLevel additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + + fun amountDiscount(amountDiscount: String) = apply { + this.amountDiscount = amountDiscount + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -26685,17 +28804,24 @@ constructor( * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26721,17 +28847,17 @@ constructor( fun build(): NewAmountDiscount = NewAmountDiscount( - checkNotNull(appliesToPriceIds) { - "`appliesToPriceIds` is required but was not set" - } - .toImmutable(), - isInvoiceLevel, checkNotNull(adjustmentType) { "`adjustmentType` is required but was not set" }, checkNotNull(amountDiscount) { "`amountDiscount` is required but was not set" }, + checkNotNull(appliesToPriceIds) { + "`appliesToPriceIds` is required but was not set" + } + .toImmutable(), + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -26793,36 +28919,44 @@ constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMinimum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, - @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("item_id") private val itemId: String, + @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -26830,14 +28964,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount - - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") fun itemId(): String = itemId - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26850,24 +28976,28 @@ constructor( } class Builder { - - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null + private var adjustmentType: AdjustmentType? = null - private var minimumAmount: String? = null + private var appliesToPriceIds: MutableList? = null private var itemId: String? = null + private var minimumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMinimum: NewMinimum) = apply { - appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMinimum.isInvoiceLevel adjustmentType = newMinimum.adjustmentType - minimumAmount = newMinimum.minimumAmount + appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() itemId = newMinimum.itemId + minimumAmount = newMinimum.minimumAmount + isInvoiceLevel = newMinimum.isInvoiceLevel additionalProperties = newMinimum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -26879,24 +29009,35 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun minimumAmount(minimumAmount: String) = apply { + this.minimumAmount = minimumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } - - fun minimumAmount(minimumAmount: String) = apply { - this.minimumAmount = minimumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26922,18 +29063,18 @@ constructor( fun build(): NewMinimum = NewMinimum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, - checkNotNull(itemId) { "`itemId` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -26995,35 +29136,40 @@ constructor( return true } - return /* spotless:off */ other is NewMinimum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMinimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, itemId, minimumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMaximum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("maximum_amount") private val maximumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -27031,11 +29177,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -27049,21 +29190,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var maximumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMaximum: NewMaximum) = apply { - appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMaximum.isInvoiceLevel adjustmentType = newMaximum.adjustmentType + appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() maximumAmount = newMaximum.maximumAmount + isInvoiceLevel = newMaximum.isInvoiceLevel additionalProperties = newMaximum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -27075,21 +29220,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun maximumAmount(maximumAmount: String) = apply { + this.maximumAmount = maximumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun maximumAmount(maximumAmount: String) = apply { - this.maximumAmount = maximumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -27115,17 +29271,17 @@ constructor( fun build(): NewMaximum = NewMaximum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(maximumAmount) { "`maximumAmount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -27187,17 +29343,17 @@ constructor( return true } - return /* spotless:off */ other is NewMaximum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, maximumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -27450,11 +29606,11 @@ constructor( @JsonCreator private constructor( @JsonProperty("price_interval_id") private val priceIntervalId: String, - @JsonProperty("start_date") private val startDate: StartDate?, + @JsonProperty("billing_cycle_day") private val billingCycleDay: Long?, @JsonProperty("end_date") private val endDate: EndDate?, @JsonProperty("fixed_fee_quantity_transitions") private val fixedFeeQuantityTransitions: List?, - @JsonProperty("billing_cycle_day") private val billingCycleDay: Long?, + @JsonProperty("start_date") private val startDate: StartDate?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -27463,11 +29619,12 @@ constructor( @JsonProperty("price_interval_id") fun priceIntervalId(): String = priceIntervalId /** - * The updated start date of this price interval. If not specified, the start date will not - * be updated. + * The updated billing cycle day for this price interval. If not specified, the billing + * cycle day will not be updated. Note that overlapping price intervals must have the same + * billing cycle day. */ - @JsonProperty("start_date") - fun startDate(): Optional = Optional.ofNullable(startDate) + @JsonProperty("billing_cycle_day") + fun billingCycleDay(): Optional = Optional.ofNullable(billingCycleDay) /** * The updated end date of this price interval. If not specified, the start date will not be @@ -27484,12 +29641,11 @@ constructor( Optional.ofNullable(fixedFeeQuantityTransitions) /** - * The updated billing cycle day for this price interval. If not specified, the billing - * cycle day will not be updated. Note that overlapping price intervals must have the same - * billing cycle day. + * The updated start date of this price interval. If not specified, the start date will not + * be updated. */ - @JsonProperty("billing_cycle_day") - fun billingCycleDay(): Optional = Optional.ofNullable(billingCycleDay) + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) @JsonAnyGetter @ExcludeMissing @@ -27505,19 +29661,19 @@ constructor( class Builder { private var priceIntervalId: String? = null - private var startDate: StartDate? = null + private var billingCycleDay: Long? = null private var endDate: EndDate? = null private var fixedFeeQuantityTransitions: MutableList? = null - private var billingCycleDay: Long? = null + private var startDate: StartDate? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(edit: Edit) = apply { priceIntervalId = edit.priceIntervalId - startDate = edit.startDate + billingCycleDay = edit.billingCycleDay endDate = edit.endDate fixedFeeQuantityTransitions = edit.fixedFeeQuantityTransitions?.toMutableList() - billingCycleDay = edit.billingCycleDay + startDate = edit.startDate additionalProperties = edit.additionalProperties.toMutableMap() } @@ -27527,24 +29683,41 @@ constructor( } /** - * The updated start date of this price interval. If not specified, the start date will - * not be updated. + * The updated billing cycle day for this price interval. If not specified, the billing + * cycle day will not be updated. Note that overlapping price intervals must have the + * same billing cycle day. */ - fun startDate(startDate: StartDate) = apply { this.startDate = startDate } - - fun startDate(dateTime: OffsetDateTime) = apply { - this.startDate = StartDate.ofDateTime(dateTime) + fun billingCycleDay(billingCycleDay: Long?) = apply { + this.billingCycleDay = billingCycleDay } - fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { - this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) - } + /** + * The updated billing cycle day for this price interval. If not specified, the billing + * cycle day will not be updated. Note that overlapping price intervals must have the + * same billing cycle day. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(billingCycleDay as Long?) + + /** + * The updated billing cycle day for this price interval. If not specified, the billing + * cycle day will not be updated. Note that overlapping price intervals must have the + * same billing cycle day. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billingCycleDay(billingCycleDay: Optional) = + billingCycleDay(billingCycleDay.orElse(null) as Long?) + + /** + * The updated end date of this price interval. If not specified, the start date will + * not be updated. + */ + fun endDate(endDate: EndDate?) = apply { this.endDate = endDate } /** * The updated end date of this price interval. If not specified, the start date will * not be updated. */ - fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) fun endDate(dateTime: OffsetDateTime) = apply { this.endDate = EndDate.ofDateTime(dateTime) @@ -27560,11 +29733,20 @@ constructor( * interval. */ fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List + fixedFeeQuantityTransitions: List? ) = apply { - this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions.toMutableList() + this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions?.toMutableList() } + /** + * A list of fixed fee quantity transitions to use for this price interval. Note that + * this list will overwrite all existing fixed fee quantity transitions on the price + * interval. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: Optional> + ) = fixedFeeQuantityTransitions(fixedFeeQuantityTransitions.orElse(null)) + /** * A list of fixed fee quantity transitions to use for this price interval. Note that * this list will overwrite all existing fixed fee quantity transitions on the price @@ -27580,12 +29762,23 @@ constructor( } /** - * The updated billing cycle day for this price interval. If not specified, the billing - * cycle day will not be updated. Note that overlapping price intervals must have the - * same billing cycle day. + * The updated start date of this price interval. If not specified, the start date will + * not be updated. */ - fun billingCycleDay(billingCycleDay: Long) = apply { - this.billingCycleDay = billingCycleDay + fun startDate(startDate: StartDate?) = apply { this.startDate = startDate } + + /** + * The updated start date of this price interval. If not specified, the start date will + * not be updated. + */ + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + + fun startDate(dateTime: OffsetDateTime) = apply { + this.startDate = StartDate.ofDateTime(dateTime) + } + + fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) } fun additionalProperties(additionalProperties: Map) = apply { @@ -27612,10 +29805,10 @@ constructor( checkNotNull(priceIntervalId) { "`priceIntervalId` is required but was not set" }, - startDate, + billingCycleDay, endDate, fixedFeeQuantityTransitions?.toImmutable(), - billingCycleDay, + startDate, additionalProperties.toImmutable(), ) } @@ -27737,18 +29930,18 @@ constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("quantity") private val quantity: Long, @JsonProperty("effective_date") private val effectiveDate: OffsetDateTime, + @JsonProperty("quantity") private val quantity: Long, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The quantity of the fixed fee quantity transition. */ - @JsonProperty("quantity") fun quantity(): Long = quantity - /** The date that the fixed fee quantity transition should take effect. */ @JsonProperty("effective_date") fun effectiveDate(): OffsetDateTime = effectiveDate + /** The quantity of the fixed fee quantity transition. */ + @JsonProperty("quantity") fun quantity(): Long = quantity + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -27762,26 +29955,26 @@ constructor( class Builder { - private var quantity: Long? = null private var effectiveDate: OffsetDateTime? = null + private var quantity: Long? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - quantity = fixedFeeQuantityTransition.quantity effectiveDate = fixedFeeQuantityTransition.effectiveDate + quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - /** The quantity of the fixed fee quantity transition. */ - fun quantity(quantity: Long) = apply { this.quantity = quantity } - /** The date that the fixed fee quantity transition should take effect. */ fun effectiveDate(effectiveDate: OffsetDateTime) = apply { this.effectiveDate = effectiveDate } + /** The quantity of the fixed fee quantity transition. */ + fun quantity(quantity: Long) = apply { this.quantity = quantity } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -27806,10 +29999,10 @@ constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - checkNotNull(quantity) { "`quantity` is required but was not set" }, checkNotNull(effectiveDate) { "`effectiveDate` is required but was not set" }, + checkNotNull(quantity) { "`quantity` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -27819,17 +30012,17 @@ constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && quantity == other.quantity && effectiveDate == other.effectiveDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(quantity, effectiveDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{quantity=$quantity, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" } /** @@ -27950,17 +30143,17 @@ constructor( return true } - return /* spotless:off */ other is Edit && priceIntervalId == other.priceIntervalId && startDate == other.startDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && billingCycleDay == other.billingCycleDay && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Edit && priceIntervalId == other.priceIntervalId && billingCycleDay == other.billingCycleDay && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceIntervalId, startDate, endDate, fixedFeeQuantityTransitions, billingCycleDay, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(priceIntervalId, billingCycleDay, endDate, fixedFeeQuantityTransitions, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Edit{priceIntervalId=$priceIntervalId, startDate=$startDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, billingCycleDay=$billingCycleDay, additionalProperties=$additionalProperties}" + "Edit{priceIntervalId=$priceIntervalId, billingCycleDay=$billingCycleDay, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -27968,8 +30161,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("adjustment_interval_id") private val adjustmentIntervalId: String, - @JsonProperty("start_date") private val startDate: StartDate?, @JsonProperty("end_date") private val endDate: EndDate?, + @JsonProperty("start_date") private val startDate: StartDate?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -27979,17 +30172,17 @@ constructor( fun adjustmentIntervalId(): String = adjustmentIntervalId /** - * The updated start date of this adjustment interval. If not specified, the start date will + * The updated end date of this adjustment interval. If not specified, the start date will * not be updated. */ - @JsonProperty("start_date") - fun startDate(): Optional = Optional.ofNullable(startDate) + @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) /** - * The updated end date of this adjustment interval. If not specified, the start date will + * The updated start date of this adjustment interval. If not specified, the start date will * not be updated. */ - @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) @JsonAnyGetter @ExcludeMissing @@ -28005,15 +30198,15 @@ constructor( class Builder { private var adjustmentIntervalId: String? = null - private var startDate: StartDate? = null private var endDate: EndDate? = null + private var startDate: StartDate? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(editAdjustment: EditAdjustment) = apply { adjustmentIntervalId = editAdjustment.adjustmentIntervalId - startDate = editAdjustment.startDate endDate = editAdjustment.endDate + startDate = editAdjustment.startDate additionalProperties = editAdjustment.additionalProperties.toMutableMap() } @@ -28023,24 +30216,16 @@ constructor( } /** - * The updated start date of this adjustment interval. If not specified, the start date + * The updated end date of this adjustment interval. If not specified, the start date * will not be updated. */ - fun startDate(startDate: StartDate) = apply { this.startDate = startDate } - - fun startDate(dateTime: OffsetDateTime) = apply { - this.startDate = StartDate.ofDateTime(dateTime) - } - - fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { - this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) - } + fun endDate(endDate: EndDate?) = apply { this.endDate = endDate } /** * The updated end date of this adjustment interval. If not specified, the start date * will not be updated. */ - fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) fun endDate(dateTime: OffsetDateTime) = apply { this.endDate = EndDate.ofDateTime(dateTime) @@ -28050,6 +30235,26 @@ constructor( this.endDate = EndDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) } + /** + * The updated start date of this adjustment interval. If not specified, the start date + * will not be updated. + */ + fun startDate(startDate: StartDate?) = apply { this.startDate = startDate } + + /** + * The updated start date of this adjustment interval. If not specified, the start date + * will not be updated. + */ + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + + fun startDate(dateTime: OffsetDateTime) = apply { + this.startDate = StartDate.ofDateTime(dateTime) + } + + fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -28074,8 +30279,8 @@ constructor( checkNotNull(adjustmentIntervalId) { "`adjustmentIntervalId` is required but was not set" }, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -28311,17 +30516,17 @@ constructor( return true } - return /* spotless:off */ other is EditAdjustment && adjustmentIntervalId == other.adjustmentIntervalId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EditAdjustment && adjustmentIntervalId == other.adjustmentIntervalId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(adjustmentIntervalId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentIntervalId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EditAdjustment{adjustmentIntervalId=$adjustmentIntervalId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "EditAdjustment{adjustmentIntervalId=$adjustmentIntervalId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt index 393dfc4a..4c628942 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionPriceIntervalsResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionPriceIntervalsResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,88 +419,173 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionPriceIntervalsResponse: SubscriptionPriceIntervalsResponse) = apply { - metadata = subscriptionPriceIntervalsResponse.metadata id = subscriptionPriceIntervalsResponse.id - customer = subscriptionPriceIntervalsResponse.customer - plan = subscriptionPriceIntervalsResponse.plan - startDate = subscriptionPriceIntervalsResponse.startDate - endDate = subscriptionPriceIntervalsResponse.endDate + activePlanPhaseOrder = subscriptionPriceIntervalsResponse.activePlanPhaseOrder + adjustmentIntervals = subscriptionPriceIntervalsResponse.adjustmentIntervals + autoCollection = subscriptionPriceIntervalsResponse.autoCollection + billingCycleAnchorConfiguration = + subscriptionPriceIntervalsResponse.billingCycleAnchorConfiguration + billingCycleDay = subscriptionPriceIntervalsResponse.billingCycleDay createdAt = subscriptionPriceIntervalsResponse.createdAt - currentBillingPeriodStartDate = - subscriptionPriceIntervalsResponse.currentBillingPeriodStartDate currentBillingPeriodEndDate = subscriptionPriceIntervalsResponse.currentBillingPeriodEndDate - status = subscriptionPriceIntervalsResponse.status - trialInfo = subscriptionPriceIntervalsResponse.trialInfo - activePlanPhaseOrder = subscriptionPriceIntervalsResponse.activePlanPhaseOrder + currentBillingPeriodStartDate = + subscriptionPriceIntervalsResponse.currentBillingPeriodStartDate + customer = subscriptionPriceIntervalsResponse.customer + defaultInvoiceMemo = subscriptionPriceIntervalsResponse.defaultInvoiceMemo + discountIntervals = subscriptionPriceIntervalsResponse.discountIntervals + endDate = subscriptionPriceIntervalsResponse.endDate fixedFeeQuantitySchedule = subscriptionPriceIntervalsResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionPriceIntervalsResponse.defaultInvoiceMemo - autoCollection = subscriptionPriceIntervalsResponse.autoCollection - netTerms = subscriptionPriceIntervalsResponse.netTerms - redeemedCoupon = subscriptionPriceIntervalsResponse.redeemedCoupon - billingCycleDay = subscriptionPriceIntervalsResponse.billingCycleDay - billingCycleAnchorConfiguration = - subscriptionPriceIntervalsResponse.billingCycleAnchorConfiguration invoicingThreshold = subscriptionPriceIntervalsResponse.invoicingThreshold - priceIntervals = subscriptionPriceIntervalsResponse.priceIntervals - adjustmentIntervals = subscriptionPriceIntervalsResponse.adjustmentIntervals - discountIntervals = subscriptionPriceIntervalsResponse.discountIntervals - minimumIntervals = subscriptionPriceIntervalsResponse.minimumIntervals maximumIntervals = subscriptionPriceIntervalsResponse.maximumIntervals + metadata = subscriptionPriceIntervalsResponse.metadata + minimumIntervals = subscriptionPriceIntervalsResponse.minimumIntervals + netTerms = subscriptionPriceIntervalsResponse.netTerms + plan = subscriptionPriceIntervalsResponse.plan + priceIntervals = subscriptionPriceIntervalsResponse.priceIntervals + redeemedCoupon = subscriptionPriceIntervalsResponse.redeemedCoupon + startDate = subscriptionPriceIntervalsResponse.startDate + status = subscriptionPriceIntervalsResponse.status + trialInfo = subscriptionPriceIntervalsResponse.trialInfo additionalProperties = subscriptionPriceIntervalsResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -537,94 +622,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -633,35 +664,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -678,45 +717,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -727,41 +742,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -784,31 +784,31 @@ private constructor( fun build(): SubscriptionPriceIntervalsResponse = SubscriptionPriceIntervalsResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -821,15 +821,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -838,32 +838,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -874,9 +874,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -892,18 +892,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -917,20 +917,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -941,6 +927,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -964,9 +964,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1220,30 +1220,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1254,22 +1266,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1284,26 +1301,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1313,12 +1313,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1333,23 +1333,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1358,6 +1358,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1382,43 +1413,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1444,12 +1444,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1511,17 +1511,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1531,48 +1531,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1581,32 +1574,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1616,6 +1608,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1625,12 +1625,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1645,24 +1645,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1671,28 +1671,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1704,17 +1687,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1732,6 +1717,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1757,12 +1757,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1824,17 +1824,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1844,21 +1844,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1868,6 +1868,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1878,15 +1884,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1895,6 +1895,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1908,18 +1917,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1935,11 +1935,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1955,22 +1955,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1980,6 +1980,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2004,28 +2020,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2066,11 +2066,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2133,17 +2133,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2153,51 +2153,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2205,35 +2201,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2241,8 +2236,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2253,13 +2253,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2274,25 +2274,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2300,6 +2300,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2315,36 +2331,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2361,11 +2352,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2392,13 +2392,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2460,17 +2460,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2480,56 +2480,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2539,29 +2548,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2571,12 +2571,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2591,23 +2591,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2615,28 +2615,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2648,17 +2631,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2676,6 +2661,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2701,12 +2701,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2768,17 +2768,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2787,17 +2787,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3162,40 +3162,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3204,16 +3195,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3225,6 +3217,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3233,12 +3233,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3252,33 +3252,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3288,20 +3281,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3321,6 +3300,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3345,12 +3345,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3411,57 +3411,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3470,18 +3458,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3493,6 +3480,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3501,12 +3501,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3520,52 +3520,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3574,24 +3572,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3617,12 +3617,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3683,60 +3683,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3745,19 +3730,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3769,6 +3755,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3777,12 +3777,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3796,25 +3796,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3822,6 +3841,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3837,39 +3870,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3894,12 +3894,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3960,17 +3960,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3978,39 +3978,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4019,10 +4019,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4036,39 +4036,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4090,10 +4090,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4103,49 +4103,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4154,6 +4147,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4161,10 +4158,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4176,12 +4170,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4190,11 +4190,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4208,37 +4208,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4258,6 +4244,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4272,6 +4264,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4293,11 +4293,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4307,17 +4307,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4404,32 +4404,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4438,6 +4431,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4445,10 +4442,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4460,12 +4454,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4474,11 +4474,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4492,37 +4492,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4542,6 +4528,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4556,6 +4548,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4577,11 +4577,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4591,17 +4591,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4613,39 +4613,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4654,6 +4671,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4884,51 +4910,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5160,34 +5183,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5198,13 +5198,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5219,26 +5219,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5246,19 +5246,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5272,6 +5301,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5732,64 +5777,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5813,13 +5813,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5828,12 +5828,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5841,16 +5841,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5861,8 +5861,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5877,24 +5877,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5902,6 +5898,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5930,8 +5930,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5942,17 +5942,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5960,17 +5960,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5980,29 +5980,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6012,8 +6012,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6028,15 +6028,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6044,16 +6044,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6076,8 +6076,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6087,17 +6087,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6259,15 +6259,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionPriceIntervalsResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionPriceIntervalsResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionPriceIntervalsResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionPriceIntervalsResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt index 64d25934..90a5609a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt @@ -476,10 +476,17 @@ constructor( * Additional adjustments to be added to the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) */ - fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments = addAdjustments.toMutableList() + fun addAdjustments(addAdjustments: List?) = apply { + this.addAdjustments = addAdjustments?.toMutableList() } + /** + * Additional adjustments to be added to the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun addAdjustments(addAdjustments: Optional>) = + addAdjustments(addAdjustments.orElse(null)) + /** * Additional adjustments to be added to the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) @@ -492,10 +499,16 @@ constructor( * Additional prices to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { - this.addPrices = addPrices.toMutableList() + fun addPrices(addPrices: List?) = apply { + this.addPrices = addPrices?.toMutableList() } + /** + * Additional prices to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addPrices(addPrices: Optional>) = addPrices(addPrices.orElse(null)) + /** * Additional prices to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -508,119 +521,272 @@ constructor( * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned * with the plan change's effective date. */ - fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Boolean) = apply { + fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Boolean?) = apply { this.alignBillingWithPlanChangeDate = alignBillingWithPlanChangeDate } + /** + * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned + * with the plan change's effective date. + */ + fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Boolean) = + alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate as Boolean?) + + /** + * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned + * with the plan change's effective date. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Optional) = + alignBillingWithPlanChangeDate( + alignBillingWithPlanChangeDate.orElse(null) as Boolean? + ) + /** * Determines whether issued invoices for this subscription will automatically be * charged with the saved payment method on the due date. If not specified, this * defaults to the behavior configured for this customer. */ - fun autoCollection(autoCollection: Boolean) = apply { + fun autoCollection(autoCollection: Boolean?) = apply { this.autoCollection = autoCollection } + /** + * Determines whether issued invoices for this subscription will automatically be + * charged with the saved payment method on the due date. If not specified, this + * defaults to the behavior configured for this customer. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Determines whether issued invoices for this subscription will automatically be + * charged with the saved payment method on the due date. If not specified, this + * defaults to the behavior configured for this customer. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) + /** * Reset billing periods to be aligned with the plan change's effective date or start of * the month. Defaults to `unchanged` which keeps subscription's existing billing cycle * alignment. */ - fun billingCycleAlignment(billingCycleAlignment: BillingCycleAlignment) = apply { + fun billingCycleAlignment(billingCycleAlignment: BillingCycleAlignment?) = apply { this.billingCycleAlignment = billingCycleAlignment } + /** + * Reset billing periods to be aligned with the plan change's effective date or start of + * the month. Defaults to `unchanged` which keeps subscription's existing billing cycle + * alignment. + */ + fun billingCycleAlignment(billingCycleAlignment: Optional) = + billingCycleAlignment(billingCycleAlignment.orElse(null)) + fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration? ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: Optional + ) = billingCycleAnchorConfiguration(billingCycleAnchorConfiguration.orElse(null)) + + /** + * The date that the plan change should take effect. This parameter can only be passed + * if the `change_option` is `requested_date`. + */ + fun changeDate(changeDate: OffsetDateTime?) = apply { this.changeDate = changeDate } + /** * The date that the plan change should take effect. This parameter can only be passed * if the `change_option` is `requested_date`. */ - fun changeDate(changeDate: OffsetDateTime) = apply { this.changeDate = changeDate } + fun changeDate(changeDate: Optional) = + changeDate(changeDate.orElse(null)) /** * Redemption code to be used for this subscription. If the coupon cannot be found by * its redemption code, or cannot be redeemed, an error response will be returned and * the subscription creation or plan change will not be scheduled. */ - fun couponRedemptionCode(couponRedemptionCode: String) = apply { + fun couponRedemptionCode(couponRedemptionCode: String?) = apply { this.couponRedemptionCode = couponRedemptionCode } - fun creditsOverageRate(creditsOverageRate: Double) = apply { + /** + * Redemption code to be used for this subscription. If the coupon cannot be found by + * its redemption code, or cannot be redeemed, an error response will be returned and + * the subscription creation or plan change will not be scheduled. + */ + fun couponRedemptionCode(couponRedemptionCode: Optional) = + couponRedemptionCode(couponRedemptionCode.orElse(null)) + + fun creditsOverageRate(creditsOverageRate: Double?) = apply { this.creditsOverageRate = creditsOverageRate } + fun creditsOverageRate(creditsOverageRate: Double) = + creditsOverageRate(creditsOverageRate as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun creditsOverageRate(creditsOverageRate: Optional) = + creditsOverageRate(creditsOverageRate.orElse(null) as Double?) + /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { this.defaultInvoiceMemo = defaultInvoiceMemo } + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + /** * The external_plan_id of the plan that the given subscription should be switched to. * Note that either this property or `plan_id` must be specified. */ - fun externalPlanId(externalPlanId: String) = apply { + fun externalPlanId(externalPlanId: String?) = apply { this.externalPlanId = externalPlanId } + /** + * The external_plan_id of the plan that the given subscription should be switched to. + * Note that either this property or `plan_id` must be specified. + */ + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: String?) = apply { this.filter = filter } + /** * An additional filter to apply to usage queries. This filter must be expressed as a * boolean * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If * null, usage queries will not include any additional filter. */ - fun filter(filter: String) = apply { this.filter = filter } + fun filter(filter: Optional) = filter(filter.orElse(null)) /** The phase of the plan to start with */ - fun initialPhaseOrder(initialPhaseOrder: Long) = apply { + fun initialPhaseOrder(initialPhaseOrder: Long?) = apply { this.initialPhaseOrder = initialPhaseOrder } + /** The phase of the plan to start with */ + fun initialPhaseOrder(initialPhaseOrder: Long) = + initialPhaseOrder(initialPhaseOrder as Long?) + + /** The phase of the plan to start with */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun initialPhaseOrder(initialPhaseOrder: Optional) = + initialPhaseOrder(initialPhaseOrder.orElse(null) as Long?) + /** * When this subscription's accrued usage reaches this threshold, an invoice will be * issued for the subscription. If not specified, invoices will only be issued at the * end of the billing period. */ - fun invoicingThreshold(invoicingThreshold: String) = apply { + fun invoicingThreshold(invoicingThreshold: String?) = apply { this.invoicingThreshold = invoicingThreshold } + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be + * issued for the subscription. If not specified, invoices will only be issued at the + * end of the billing period. + */ + fun invoicingThreshold(invoicingThreshold: Optional) = + invoicingThreshold(invoicingThreshold.orElse(null)) + + /** + * The net terms determines the difference between the invoice date and the issue date + * for the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + fun netTerms(netTerms: Long?) = apply { this.netTerms = netTerms } + + /** + * The net terms determines the difference between the invoice date and the issue date + * for the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) + /** * The net terms determines the difference between the invoice date and the issue date * for the invoice. If you intend the invoice to be due on issue, set this to 0. If not * provided, this defaults to the value specified in the plan. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.orElse(null) as Long?) - fun perCreditOverageAmount(perCreditOverageAmount: Double) = apply { + fun perCreditOverageAmount(perCreditOverageAmount: Double?) = apply { this.perCreditOverageAmount = perCreditOverageAmount } + fun perCreditOverageAmount(perCreditOverageAmount: Double) = + perCreditOverageAmount(perCreditOverageAmount as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perCreditOverageAmount(perCreditOverageAmount: Optional) = + perCreditOverageAmount(perCreditOverageAmount.orElse(null) as Double?) + + /** + * The plan that the given subscription should be switched to. Note that either this + * property or `external_plan_id` must be specified. + */ + fun planId(planId: String?) = apply { this.planId = planId } + /** * The plan that the given subscription should be switched to. Note that either this * property or `external_plan_id` must be specified. */ - fun planId(planId: String) = apply { this.planId = planId } + fun planId(planId: Optional) = planId(planId.orElse(null)) /** * Specifies which version of the plan to change to. If null, the default version will * be used. */ - fun planVersionNumber(planVersionNumber: Long) = apply { + fun planVersionNumber(planVersionNumber: Long?) = apply { this.planVersionNumber = planVersionNumber } + /** + * Specifies which version of the plan to change to. If null, the default version will + * be used. + */ + fun planVersionNumber(planVersionNumber: Long) = + planVersionNumber(planVersionNumber as Long?) + + /** + * Specifies which version of the plan to change to. If null, the default version will + * be used. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planVersionNumber(planVersionNumber: Optional) = + planVersionNumber(planVersionNumber.orElse(null) as Long?) + /** Optionally provide a list of overrides for prices on the plan */ - fun priceOverrides(priceOverrides: List) = apply { - this.priceOverrides = priceOverrides.toMutableList() + fun priceOverrides(priceOverrides: List?) = apply { + this.priceOverrides = priceOverrides?.toMutableList() } + /** Optionally provide a list of overrides for prices on the plan */ + fun priceOverrides(priceOverrides: Optional>) = + priceOverrides(priceOverrides.orElse(null)) + /** Optionally provide a list of overrides for prices on the plan */ fun addPriceOverride(priceOverride: JsonValue) = apply { priceOverrides = (priceOverrides ?: mutableListOf()).apply { add(priceOverride) } @@ -630,10 +796,17 @@ constructor( * Plan adjustments to be removed from the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) */ - fun removeAdjustments(removeAdjustments: List) = apply { - this.removeAdjustments = removeAdjustments.toMutableList() + fun removeAdjustments(removeAdjustments: List?) = apply { + this.removeAdjustments = removeAdjustments?.toMutableList() } + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun removeAdjustments(removeAdjustments: Optional>) = + removeAdjustments(removeAdjustments.orElse(null)) + /** * Plan adjustments to be removed from the subscription. (Only available for accounts * that have migrated off of legacy subscription overrides) @@ -647,10 +820,17 @@ constructor( * Plan prices to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun removePrices(removePrices: List) = apply { - this.removePrices = removePrices.toMutableList() + fun removePrices(removePrices: List?) = apply { + this.removePrices = removePrices?.toMutableList() } + /** + * Plan prices to be removed from the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun removePrices(removePrices: Optional>) = + removePrices(removePrices.orElse(null)) + /** * Plan prices to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -663,10 +843,17 @@ constructor( * Plan adjustments to be replaced with additional adjustments on the subscription. * (Only available for accounts that have migrated off of legacy subscription overrides) */ - fun replaceAdjustments(replaceAdjustments: List) = apply { - this.replaceAdjustments = replaceAdjustments.toMutableList() + fun replaceAdjustments(replaceAdjustments: List?) = apply { + this.replaceAdjustments = replaceAdjustments?.toMutableList() } + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. + * (Only available for accounts that have migrated off of legacy subscription overrides) + */ + fun replaceAdjustments(replaceAdjustments: Optional>) = + replaceAdjustments(replaceAdjustments.orElse(null)) + /** * Plan adjustments to be replaced with additional adjustments on the subscription. * (Only available for accounts that have migrated off of legacy subscription overrides) @@ -680,10 +867,17 @@ constructor( * Plan prices to be replaced with additional prices on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) */ - fun replacePrices(replacePrices: List) = apply { - this.replacePrices = replacePrices.toMutableList() + fun replacePrices(replacePrices: List?) = apply { + this.replacePrices = replacePrices?.toMutableList() } + /** + * Plan prices to be replaced with additional prices on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun replacePrices(replacePrices: Optional>) = + replacePrices(replacePrices.orElse(null)) + /** * Plan prices to be replaced with additional prices on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) @@ -696,10 +890,25 @@ constructor( * The duration of the trial period in days. If not provided, this defaults to the value * specified in the plan. If `0` is provided, the trial on the plan will be skipped. */ - fun trialDurationDays(trialDurationDays: Long) = apply { + fun trialDurationDays(trialDurationDays: Long?) = apply { this.trialDurationDays = trialDurationDays } + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + fun trialDurationDays(trialDurationDays: Long) = + trialDurationDays(trialDurationDays as Long?) + + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun trialDurationDays(trialDurationDays: Optional) = + trialDurationDays(trialDurationDays.orElse(null) as Long?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -803,10 +1012,17 @@ constructor( * Additional adjustments to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun addAdjustments(addAdjustments: List) = apply { + fun addAdjustments(addAdjustments: List?) = apply { body.addAdjustments(addAdjustments) } + /** + * Additional adjustments to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addAdjustments(addAdjustments: Optional>) = + addAdjustments(addAdjustments.orElse(null)) + /** * Additional adjustments to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -819,7 +1035,13 @@ constructor( * Additional prices to be added to the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { body.addPrices(addPrices) } + fun addPrices(addPrices: List?) = apply { body.addPrices(addPrices) } + + /** + * Additional prices to be added to the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun addPrices(addPrices: Optional>) = addPrices(addPrices.orElse(null)) /** * Additional prices to be added to the subscription. (Only available for accounts that have @@ -831,62 +1053,140 @@ constructor( * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned * with the plan change's effective date. */ - fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Boolean) = apply { + fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Boolean?) = apply { body.alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate) } + /** + * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned + * with the plan change's effective date. + */ + fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Boolean) = + alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate as Boolean?) + + /** + * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned + * with the plan change's effective date. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Optional) = + alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate.orElse(null) as Boolean?) + + /** + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. If not specified, this defaults to the + * behavior configured for this customer. + */ + fun autoCollection(autoCollection: Boolean?) = apply { body.autoCollection(autoCollection) } + + /** + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. If not specified, this defaults to the + * behavior configured for this customer. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + /** * Determines whether issued invoices for this subscription will automatically be charged * with the saved payment method on the due date. If not specified, this defaults to the * behavior configured for this customer. */ - fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) /** * Reset billing periods to be aligned with the plan change's effective date or start of the * month. Defaults to `unchanged` which keeps subscription's existing billing cycle * alignment. */ - fun billingCycleAlignment(billingCycleAlignment: BillingCycleAlignment) = apply { + fun billingCycleAlignment(billingCycleAlignment: BillingCycleAlignment?) = apply { body.billingCycleAlignment(billingCycleAlignment) } + /** + * Reset billing periods to be aligned with the plan change's effective date or start of the + * month. Defaults to `unchanged` which keeps subscription's existing billing cycle + * alignment. + */ + fun billingCycleAlignment(billingCycleAlignment: Optional) = + billingCycleAlignment(billingCycleAlignment.orElse(null)) + fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration? ) = apply { body.billingCycleAnchorConfiguration(billingCycleAnchorConfiguration) } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: Optional + ) = billingCycleAnchorConfiguration(billingCycleAnchorConfiguration.orElse(null)) + + /** + * The date that the plan change should take effect. This parameter can only be passed if + * the `change_option` is `requested_date`. + */ + fun changeDate(changeDate: OffsetDateTime?) = apply { body.changeDate(changeDate) } + /** * The date that the plan change should take effect. This parameter can only be passed if * the `change_option` is `requested_date`. */ - fun changeDate(changeDate: OffsetDateTime) = apply { body.changeDate(changeDate) } + fun changeDate(changeDate: Optional) = changeDate(changeDate.orElse(null)) /** * Redemption code to be used for this subscription. If the coupon cannot be found by its * redemption code, or cannot be redeemed, an error response will be returned and the * subscription creation or plan change will not be scheduled. */ - fun couponRedemptionCode(couponRedemptionCode: String) = apply { + fun couponRedemptionCode(couponRedemptionCode: String?) = apply { body.couponRedemptionCode(couponRedemptionCode) } - fun creditsOverageRate(creditsOverageRate: Double) = apply { + /** + * Redemption code to be used for this subscription. If the coupon cannot be found by its + * redemption code, or cannot be redeemed, an error response will be returned and the + * subscription creation or plan change will not be scheduled. + */ + fun couponRedemptionCode(couponRedemptionCode: Optional) = + couponRedemptionCode(couponRedemptionCode.orElse(null)) + + fun creditsOverageRate(creditsOverageRate: Double?) = apply { body.creditsOverageRate(creditsOverageRate) } + fun creditsOverageRate(creditsOverageRate: Double) = + creditsOverageRate(creditsOverageRate as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun creditsOverageRate(creditsOverageRate: Optional) = + creditsOverageRate(creditsOverageRate.orElse(null) as Double?) + /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { body.defaultInvoiceMemo(defaultInvoiceMemo) } + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + + /** + * The external_plan_id of the plan that the given subscription should be switched to. Note + * that either this property or `plan_id` must be specified. + */ + fun externalPlanId(externalPlanId: String?) = apply { body.externalPlanId(externalPlanId) } + /** * The external_plan_id of the plan that the given subscription should be switched to. Note * that either this property or `plan_id` must be specified. */ - fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } + fun externalPlanId(externalPlanId: Optional) = + externalPlanId(externalPlanId.orElse(null)) /** * An additional filter to apply to usage queries. This filter must be expressed as a @@ -894,52 +1194,124 @@ constructor( * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If * null, usage queries will not include any additional filter. */ - fun filter(filter: String) = apply { body.filter(filter) } + fun filter(filter: String?) = apply { body.filter(filter) } + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a + * boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If + * null, usage queries will not include any additional filter. + */ + fun filter(filter: Optional) = filter(filter.orElse(null)) /** The phase of the plan to start with */ - fun initialPhaseOrder(initialPhaseOrder: Long) = apply { + fun initialPhaseOrder(initialPhaseOrder: Long?) = apply { body.initialPhaseOrder(initialPhaseOrder) } + /** The phase of the plan to start with */ + fun initialPhaseOrder(initialPhaseOrder: Long) = + initialPhaseOrder(initialPhaseOrder as Long?) + + /** The phase of the plan to start with */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun initialPhaseOrder(initialPhaseOrder: Optional) = + initialPhaseOrder(initialPhaseOrder.orElse(null) as Long?) + /** * When this subscription's accrued usage reaches this threshold, an invoice will be issued * for the subscription. If not specified, invoices will only be issued at the end of the * billing period. */ - fun invoicingThreshold(invoicingThreshold: String) = apply { + fun invoicingThreshold(invoicingThreshold: String?) = apply { body.invoicingThreshold(invoicingThreshold) } + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be issued + * for the subscription. If not specified, invoices will only be issued at the end of the + * billing period. + */ + fun invoicingThreshold(invoicingThreshold: Optional) = + invoicingThreshold(invoicingThreshold.orElse(null)) + /** * The net terms determines the difference between the invoice date and the issue date for * the invoice. If you intend the invoice to be due on issue, set this to 0. If not * provided, this defaults to the value specified in the plan. */ - fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } + fun netTerms(netTerms: Long?) = apply { body.netTerms(netTerms) } - fun perCreditOverageAmount(perCreditOverageAmount: Double) = apply { + /** + * The net terms determines the difference between the invoice date and the issue date for + * the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) + + /** + * The net terms determines the difference between the invoice date and the issue date for + * the invoice. If you intend the invoice to be due on issue, set this to 0. If not + * provided, this defaults to the value specified in the plan. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.orElse(null) as Long?) + + fun perCreditOverageAmount(perCreditOverageAmount: Double?) = apply { body.perCreditOverageAmount(perCreditOverageAmount) } + fun perCreditOverageAmount(perCreditOverageAmount: Double) = + perCreditOverageAmount(perCreditOverageAmount as Double?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun perCreditOverageAmount(perCreditOverageAmount: Optional) = + perCreditOverageAmount(perCreditOverageAmount.orElse(null) as Double?) + /** * The plan that the given subscription should be switched to. Note that either this * property or `external_plan_id` must be specified. */ - fun planId(planId: String) = apply { body.planId(planId) } + fun planId(planId: String?) = apply { body.planId(planId) } + + /** + * The plan that the given subscription should be switched to. Note that either this + * property or `external_plan_id` must be specified. + */ + fun planId(planId: Optional) = planId(planId.orElse(null)) /** * Specifies which version of the plan to change to. If null, the default version will be * used. */ - fun planVersionNumber(planVersionNumber: Long) = apply { + fun planVersionNumber(planVersionNumber: Long?) = apply { body.planVersionNumber(planVersionNumber) } + /** + * Specifies which version of the plan to change to. If null, the default version will be + * used. + */ + fun planVersionNumber(planVersionNumber: Long) = + planVersionNumber(planVersionNumber as Long?) + + /** + * Specifies which version of the plan to change to. If null, the default version will be + * used. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planVersionNumber(planVersionNumber: Optional) = + planVersionNumber(planVersionNumber.orElse(null) as Long?) + /** Optionally provide a list of overrides for prices on the plan */ - fun priceOverrides(priceOverrides: List) = apply { + fun priceOverrides(priceOverrides: List?) = apply { body.priceOverrides(priceOverrides) } + /** Optionally provide a list of overrides for prices on the plan */ + fun priceOverrides(priceOverrides: Optional>) = + priceOverrides(priceOverrides.orElse(null)) + /** Optionally provide a list of overrides for prices on the plan */ fun addPriceOverride(priceOverride: JsonValue) = apply { body.addPriceOverride(priceOverride) @@ -949,10 +1321,17 @@ constructor( * Plan adjustments to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun removeAdjustments(removeAdjustments: List) = apply { + fun removeAdjustments(removeAdjustments: List?) = apply { body.removeAdjustments(removeAdjustments) } + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun removeAdjustments(removeAdjustments: Optional>) = + removeAdjustments(removeAdjustments.orElse(null)) + /** * Plan adjustments to be removed from the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -965,10 +1344,17 @@ constructor( * Plan prices to be removed from the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun removePrices(removePrices: List) = apply { + fun removePrices(removePrices: List?) = apply { body.removePrices(removePrices) } + /** + * Plan prices to be removed from the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun removePrices(removePrices: Optional>) = + removePrices(removePrices.orElse(null)) + /** * Plan prices to be removed from the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) @@ -979,10 +1365,17 @@ constructor( * Plan adjustments to be replaced with additional adjustments on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) */ - fun replaceAdjustments(replaceAdjustments: List) = apply { + fun replaceAdjustments(replaceAdjustments: List?) = apply { body.replaceAdjustments(replaceAdjustments) } + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun replaceAdjustments(replaceAdjustments: Optional>) = + replaceAdjustments(replaceAdjustments.orElse(null)) + /** * Plan adjustments to be replaced with additional adjustments on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) @@ -995,10 +1388,17 @@ constructor( * Plan prices to be replaced with additional prices on the subscription. (Only available * for accounts that have migrated off of legacy subscription overrides) */ - fun replacePrices(replacePrices: List) = apply { + fun replacePrices(replacePrices: List?) = apply { body.replacePrices(replacePrices) } + /** + * Plan prices to be replaced with additional prices on the subscription. (Only available + * for accounts that have migrated off of legacy subscription overrides) + */ + fun replacePrices(replacePrices: Optional>) = + replacePrices(replacePrices.orElse(null)) + /** * Plan prices to be replaced with additional prices on the subscription. (Only available * for accounts that have migrated off of legacy subscription overrides) @@ -1011,10 +1411,25 @@ constructor( * The duration of the trial period in days. If not provided, this defaults to the value * specified in the plan. If `0` is provided, the trial on the plan will be skipped. */ - fun trialDurationDays(trialDurationDays: Long) = apply { + fun trialDurationDays(trialDurationDays: Long?) = apply { body.trialDurationDays(trialDurationDays) } + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + fun trialDurationDays(trialDurationDays: Long) = + trialDurationDays(trialDurationDays as Long?) + + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun trialDurationDays(trialDurationDays: Optional) = + trialDurationDays(trialDurationDays.orElse(null) as Long?) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -1209,9 +1624,9 @@ constructor( @JsonCreator private constructor( @JsonProperty("adjustment") private val adjustment: Adjustment, - @JsonProperty("start_date") private val startDate: OffsetDateTime?, @JsonProperty("end_date") private val endDate: OffsetDateTime?, @JsonProperty("plan_phase_order") private val planPhaseOrder: Long?, + @JsonProperty("start_date") private val startDate: OffsetDateTime?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -1219,14 +1634,6 @@ constructor( /** The definition of a new adjustment to create and add to the subscription. */ @JsonProperty("adjustment") fun adjustment(): Adjustment = adjustment - /** - * The start date of the adjustment interval. This is the date that the adjustment will - * start affecting prices on the subscription. If null, the adjustment will start when the - * phase or subscription starts. - */ - @JsonProperty("start_date") - fun startDate(): Optional = Optional.ofNullable(startDate) - /** * The end date of the adjustment interval. This is the date that the adjustment will stop * affecting prices on the subscription. If null, the adjustment will start when the phase @@ -1239,6 +1646,14 @@ constructor( @JsonProperty("plan_phase_order") fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder) + /** + * The start date of the adjustment interval. This is the date that the adjustment will + * start affecting prices on the subscription. If null, the adjustment will start when the + * phase or subscription starts. + */ + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1253,17 +1668,17 @@ constructor( class Builder { private var adjustment: Adjustment? = null - private var startDate: OffsetDateTime? = null private var endDate: OffsetDateTime? = null private var planPhaseOrder: Long? = null + private var startDate: OffsetDateTime? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(addAdjustment: AddAdjustment) = apply { adjustment = addAdjustment.adjustment - startDate = addAdjustment.startDate endDate = addAdjustment.endDate planPhaseOrder = addAdjustment.planPhaseOrder + startDate = addAdjustment.startDate additionalProperties = addAdjustment.additionalProperties.toMutableMap() } @@ -1291,24 +1706,46 @@ constructor( } /** - * The start date of the adjustment interval. This is the date that the adjustment will - * start affecting prices on the subscription. If null, the adjustment will start when + * The end date of the adjustment interval. This is the date that the adjustment will + * stop affecting prices on the subscription. If null, the adjustment will start when * the phase or subscription starts. */ - fun startDate(startDate: OffsetDateTime) = apply { this.startDate = startDate } + fun endDate(endDate: OffsetDateTime?) = apply { this.endDate = endDate } /** * The end date of the adjustment interval. This is the date that the adjustment will * stop affecting prices on the subscription. If null, the adjustment will start when * the phase or subscription starts. */ - fun endDate(endDate: OffsetDateTime) = apply { this.endDate = endDate } + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) /** The phase to add this adjustment to. */ - fun planPhaseOrder(planPhaseOrder: Long) = apply { + fun planPhaseOrder(planPhaseOrder: Long?) = apply { this.planPhaseOrder = planPhaseOrder } + /** The phase to add this adjustment to. */ + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(planPhaseOrder as Long?) + + /** The phase to add this adjustment to. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planPhaseOrder(planPhaseOrder: Optional) = + planPhaseOrder(planPhaseOrder.orElse(null) as Long?) + + /** + * The start date of the adjustment interval. This is the date that the adjustment will + * start affecting prices on the subscription. If null, the adjustment will start when + * the phase or subscription starts. + */ + fun startDate(startDate: OffsetDateTime?) = apply { this.startDate = startDate } + + /** + * The start date of the adjustment interval. This is the date that the adjustment will + * start affecting prices on the subscription. If null, the adjustment will start when + * the phase or subscription starts. + */ + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1331,9 +1768,9 @@ constructor( fun build(): AddAdjustment = AddAdjustment( checkNotNull(adjustment) { "`adjustment` is required but was not set" }, - startDate, endDate, planPhaseOrder, + startDate, additionalProperties.toImmutable(), ) } @@ -1526,18 +1963,24 @@ constructor( class NewPercentageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("percentage_discount") private val percentageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("percentage_discount") + fun percentageDiscount(): Double = percentageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -1545,12 +1988,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("percentage_discount") - fun percentageDiscount(): Double = percentageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1564,22 +2001,26 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var percentageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel adjustmentType = newPercentageDiscount.adjustmentType + appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() percentageDiscount = newPercentageDiscount.percentageDiscount + isInvoiceLevel = newPercentageDiscount.isInvoiceLevel additionalProperties = newPercentageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -1591,21 +2032,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun percentageDiscount(percentageDiscount: Double) = apply { + this.percentageDiscount = percentageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun percentageDiscount(percentageDiscount: Double) = apply { - this.percentageDiscount = percentageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1631,17 +2083,17 @@ constructor( fun build(): NewPercentageDiscount = NewPercentageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(percentageDiscount) { "`percentageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -1703,35 +2155,40 @@ constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, percentageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewUsageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("usage_discount") private val usageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -1739,11 +2196,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1757,21 +2209,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var usageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newUsageDiscount.isInvoiceLevel adjustmentType = newUsageDiscount.adjustmentType + appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() usageDiscount = newUsageDiscount.usageDiscount + isInvoiceLevel = newUsageDiscount.isInvoiceLevel additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -1783,21 +2239,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun usageDiscount(usageDiscount: Double) = apply { + this.usageDiscount = usageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun usageDiscount(usageDiscount: Double) = apply { - this.usageDiscount = usageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1823,17 +2290,17 @@ constructor( fun build(): NewUsageDiscount = NewUsageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(usageDiscount) { "`usageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -1895,31 +2362,36 @@ constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, usageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewAmountDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, @JsonProperty("amount_discount") private val amountDiscount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + + @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds @@ -1931,11 +2403,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1949,21 +2416,29 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null + private var appliesToPriceIds: MutableList? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newAmountDiscount.isInvoiceLevel adjustmentType = newAmountDiscount.adjustmentType amountDiscount = newAmountDiscount.amountDiscount + appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() + isInvoiceLevel = newAmountDiscount.isInvoiceLevel additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + + fun amountDiscount(amountDiscount: String) = apply { + this.amountDiscount = amountDiscount + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -1979,17 +2454,24 @@ constructor( * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2015,17 +2497,17 @@ constructor( fun build(): NewAmountDiscount = NewAmountDiscount( - checkNotNull(appliesToPriceIds) { - "`appliesToPriceIds` is required but was not set" - } - .toImmutable(), - isInvoiceLevel, checkNotNull(adjustmentType) { "`adjustmentType` is required but was not set" }, checkNotNull(amountDiscount) { "`amountDiscount` is required but was not set" }, + checkNotNull(appliesToPriceIds) { + "`appliesToPriceIds` is required but was not set" + } + .toImmutable(), + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -2087,36 +2569,44 @@ constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMinimum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, - @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("item_id") private val itemId: String, + @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -2124,14 +2614,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount - - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") fun itemId(): String = itemId - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2145,23 +2627,27 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null - private var minimumAmount: String? = null + private var appliesToPriceIds: MutableList? = null private var itemId: String? = null + private var minimumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMinimum: NewMinimum) = apply { - appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMinimum.isInvoiceLevel adjustmentType = newMinimum.adjustmentType - minimumAmount = newMinimum.minimumAmount + appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() itemId = newMinimum.itemId + minimumAmount = newMinimum.minimumAmount + isInvoiceLevel = newMinimum.isInvoiceLevel additionalProperties = newMinimum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -2173,24 +2659,35 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun minimumAmount(minimumAmount: String) = apply { + this.minimumAmount = minimumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } - - fun minimumAmount(minimumAmount: String) = apply { - this.minimumAmount = minimumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2216,18 +2713,18 @@ constructor( fun build(): NewMinimum = NewMinimum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, - checkNotNull(itemId) { "`itemId` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -2289,35 +2786,40 @@ constructor( return true } - return /* spotless:off */ other is NewMinimum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMinimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, itemId, minimumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMaximum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("maximum_amount") private val maximumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -2325,11 +2827,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2343,21 +2840,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var maximumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMaximum: NewMaximum) = apply { - appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMaximum.isInvoiceLevel adjustmentType = newMaximum.adjustmentType + appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() maximumAmount = newMaximum.maximumAmount + isInvoiceLevel = newMaximum.isInvoiceLevel additionalProperties = newMaximum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -2369,21 +2870,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun maximumAmount(maximumAmount: String) = apply { + this.maximumAmount = maximumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun maximumAmount(maximumAmount: String) = apply { - this.maximumAmount = maximumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2409,17 +2921,17 @@ constructor( fun build(): NewMaximum = NewMaximum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(maximumAmount) { "`maximumAmount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -2481,17 +2993,17 @@ constructor( return true } - return /* spotless:off */ other is NewMaximum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, maximumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -2500,52 +3012,41 @@ constructor( return true } - return /* spotless:off */ other is AddAdjustment && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && planPhaseOrder == other.planPhaseOrder && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddAdjustment && adjustment == other.adjustment && endDate == other.endDate && planPhaseOrder == other.planPhaseOrder && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(adjustment, startDate, endDate, planPhaseOrder, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustment, endDate, planPhaseOrder, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddAdjustment{adjustment=$adjustment, startDate=$startDate, endDate=$endDate, planPhaseOrder=$planPhaseOrder, additionalProperties=$additionalProperties}" + "AddAdjustment{adjustment=$adjustment, endDate=$endDate, planPhaseOrder=$planPhaseOrder, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class AddPrice @JsonCreator private constructor( - @JsonProperty("price_id") private val priceId: String?, + @JsonProperty("discounts") private val discounts: List?, + @JsonProperty("end_date") private val endDate: OffsetDateTime?, @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("maximum_amount") private val maximumAmount: String?, + @JsonProperty("minimum_amount") private val minimumAmount: String?, + @JsonProperty("plan_phase_order") private val planPhaseOrder: Long?, @JsonProperty("price") private val price: Price?, + @JsonProperty("price_id") private val priceId: String?, @JsonProperty("start_date") private val startDate: OffsetDateTime?, - @JsonProperty("end_date") private val endDate: OffsetDateTime?, - @JsonProperty("plan_phase_order") private val planPhaseOrder: Long?, - @JsonProperty("minimum_amount") private val minimumAmount: String?, - @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("discounts") private val discounts: List?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the price to add to the subscription. */ - @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) - - /** The external price id of the price to add to the subscription. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) - - /** The definition of a new price to create and add to the subscription. */ - @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) - /** - * The start date of the price interval. This is the date that the price will start billing - * on the subscription. If null, billing will start when the phase or subscription starts. + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this price. */ - @JsonProperty("start_date") - fun startDate(): Optional = Optional.ofNullable(startDate) + @JsonProperty("discounts") + fun discounts(): Optional> = Optional.ofNullable(discounts) /** * The end date of the price interval. This is the date that the price will stop billing on @@ -2554,29 +3055,40 @@ constructor( @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) - /** The phase to add this price to. */ - @JsonProperty("plan_phase_order") - fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder) + /** The external price id of the price to add to the subscription. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this * price. */ - @JsonProperty("minimum_amount") - fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + @JsonProperty("maximum_amount") + fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this * price. */ - @JsonProperty("maximum_amount") - fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) + @JsonProperty("minimum_amount") + fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + + /** The phase to add this price to. */ + @JsonProperty("plan_phase_order") + fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder) + + /** The definition of a new price to create and add to the subscription. */ + @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) + + /** The id of the price to add to the subscription. */ + @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this price. + * The start date of the price interval. This is the date that the price will start billing + * on the subscription. If null, billing will start when the phase or subscription starts. */ - @JsonProperty("discounts") - fun discounts(): Optional> = Optional.ofNullable(discounts) + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) @JsonAnyGetter @ExcludeMissing @@ -2591,41 +3103,118 @@ constructor( class Builder { - private var priceId: String? = null + private var discounts: MutableList? = null + private var endDate: OffsetDateTime? = null private var externalPriceId: String? = null + private var maximumAmount: String? = null + private var minimumAmount: String? = null + private var planPhaseOrder: Long? = null private var price: Price? = null + private var priceId: String? = null private var startDate: OffsetDateTime? = null - private var endDate: OffsetDateTime? = null - private var planPhaseOrder: Long? = null - private var minimumAmount: String? = null - private var maximumAmount: String? = null - private var discounts: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(addPrice: AddPrice) = apply { - priceId = addPrice.priceId + discounts = addPrice.discounts?.toMutableList() + endDate = addPrice.endDate externalPriceId = addPrice.externalPriceId + maximumAmount = addPrice.maximumAmount + minimumAmount = addPrice.minimumAmount + planPhaseOrder = addPrice.planPhaseOrder price = addPrice.price + priceId = addPrice.priceId startDate = addPrice.startDate - endDate = addPrice.endDate - planPhaseOrder = addPrice.planPhaseOrder - minimumAmount = addPrice.minimumAmount - maximumAmount = addPrice.maximumAmount - discounts = addPrice.discounts?.toMutableList() additionalProperties = addPrice.additionalProperties.toMutableMap() } - /** The id of the price to add to the subscription. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun discounts(discounts: List?) = apply { + this.discounts = discounts?.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun discounts(discounts: Optional>) = discounts(discounts.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } + + /** + * The end date of the price interval. This is the date that the price will stop billing + * on the subscription. If null, billing will end when the phase or subscription ends. + */ + fun endDate(endDate: OffsetDateTime?) = apply { this.endDate = endDate } + + /** + * The end date of the price interval. This is the date that the price will stop billing + * on the subscription. If null, billing will end when the phase or subscription ends. + */ + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) /** The external price id of the price to add to the subscription. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** The external price id of the price to add to the subscription. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this + * price. + */ + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this + * price. + */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this + * price. + */ + fun minimumAmount(minimumAmount: String?) = apply { this.minimumAmount = minimumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this + * price. + */ + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null)) + + /** The phase to add this price to. */ + fun planPhaseOrder(planPhaseOrder: Long?) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The phase to add this price to. */ + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(planPhaseOrder as Long?) + + /** The phase to add this price to. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun planPhaseOrder(planPhaseOrder: Optional) = + planPhaseOrder(planPhaseOrder.orElse(null) as Long?) + + /** The definition of a new price to create and add to the subscription. */ + fun price(price: Price?) = apply { this.price = price } + /** The definition of a new price to create and add to the subscription. */ - fun price(price: Price) = apply { this.price = price } + fun price(price: Optional) = price(price.orElse(null)) fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) @@ -2747,51 +3336,25 @@ constructor( ) } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: String?) = apply { this.priceId = priceId } + + /** The id of the price to add to the subscription. */ + fun priceId(priceId: Optional) = priceId(priceId.orElse(null)) + /** * The start date of the price interval. This is the date that the price will start * billing on the subscription. If null, billing will start when the phase or * subscription starts. */ - fun startDate(startDate: OffsetDateTime) = apply { this.startDate = startDate } + fun startDate(startDate: OffsetDateTime?) = apply { this.startDate = startDate } /** - * The end date of the price interval. This is the date that the price will stop billing - * on the subscription. If null, billing will end when the phase or subscription ends. - */ - fun endDate(endDate: OffsetDateTime) = apply { this.endDate = endDate } - - /** The phase to add this price to. */ - fun planPhaseOrder(planPhaseOrder: Long) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for this - * price. - */ - fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for this - * price. - */ - fun maximumAmount(maximumAmount: String) = apply { this.maximumAmount = maximumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this - * price. - */ - fun discounts(discounts: List) = apply { - this.discounts = discounts.toMutableList() - } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this - * price. + * The start date of the price interval. This is the date that the price will start + * billing on the subscription. If null, billing will start when the phase or + * subscription starts. */ - fun addDiscount(discount: Discount) = apply { - discounts = (discounts ?: mutableListOf()).apply { add(discount) } - } + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2814,15 +3377,15 @@ constructor( fun build(): AddPrice = AddPrice( - priceId, + discounts?.toImmutable(), + endDate, externalPriceId, + maximumAmount, + minimumAmount, + planPhaseOrder, price, + priceId, startDate, - endDate, - planPhaseOrder, - minimumAmount, - maximumAmount, - discounts?.toImmutable(), additionalProperties.toImmutable(), ) } @@ -2832,15 +3395,19 @@ constructor( @JsonCreator private constructor( @JsonProperty("discount_type") private val discountType: DiscountType, + @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonProperty("percentage_discount") private val percentageDiscount: Double?, @JsonProperty("usage_discount") private val usageDiscount: Double?, - @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @JsonProperty("discount_type") fun discountType(): DiscountType = discountType + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) + /** * Only available if discount_type is `percentage`. This is a number between 0 and 1. */ @@ -2854,10 +3421,6 @@ constructor( @JsonProperty("usage_discount") fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") - fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2872,17 +3435,17 @@ constructor( class Builder { private var discountType: DiscountType? = null + private var amountDiscount: String? = null private var percentageDiscount: Double? = null private var usageDiscount: Double? = null - private var amountDiscount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(discount: Discount) = apply { discountType = discount.discountType + amountDiscount = discount.amountDiscount percentageDiscount = discount.percentageDiscount usageDiscount = discount.usageDiscount - amountDiscount = discount.amountDiscount additionalProperties = discount.additionalProperties.toMutableMap() } @@ -2890,26 +3453,59 @@ constructor( this.discountType = discountType } + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: String?) = apply { + this.amountDiscount = amountDiscount + } + + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: Optional) = + amountDiscount(amountDiscount.orElse(null)) + /** * Only available if discount_type is `percentage`. This is a number between 0 * and 1. */ - fun percentageDiscount(percentageDiscount: Double) = apply { + fun percentageDiscount(percentageDiscount: Double?) = apply { this.percentageDiscount = percentageDiscount } + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(percentageDiscount as Double?) + + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun percentageDiscount(percentageDiscount: Optional) = + percentageDiscount(percentageDiscount.orElse(null) as Double?) + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for */ - fun usageDiscount(usageDiscount: Double) = apply { + fun usageDiscount(usageDiscount: Double?) = apply { this.usageDiscount = usageDiscount } - /** Only available if discount_type is `amount`. */ - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + fun usageDiscount(usageDiscount: Double) = usageDiscount(usageDiscount as Double?) + + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun usageDiscount(usageDiscount: Optional) = + usageDiscount(usageDiscount.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2936,9 +3532,9 @@ constructor( fun build(): Discount = Discount( checkNotNull(discountType) { "`discountType` is required but was not set" }, + amountDiscount, percentageDiscount, usageDiscount, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -3011,17 +3607,17 @@ constructor( return true } - return /* spotless:off */ other is Discount && discountType == other.discountType && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Discount && discountType == other.discountType && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, usageDiscount, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, percentageDiscount, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Discount{discountType=$discountType, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "Discount{discountType=$discountType, amountDiscount=$amountDiscount, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } /** The definition of a new price to create and add to the subscription. */ @@ -3810,43 +4406,41 @@ constructor( class NewSubscriptionUnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -3854,9 +4448,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -3864,6 +4455,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -3875,17 +4489,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -3894,20 +4497,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -3929,136 +4525,230 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitConfig: UnitConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitConfig: UnitConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - metadata = newSubscriptionUnitPrice.metadata - externalPriceId = newSubscriptionUnitPrice.externalPriceId + cadence = newSubscriptionUnitPrice.cadence + itemId = newSubscriptionUnitPrice.itemId + modelType = newSubscriptionUnitPrice.modelType name = newSubscriptionUnitPrice.name + unitConfig = newSubscriptionUnitPrice.unitConfig billableMetricId = newSubscriptionUnitPrice.billableMetricId - itemId = newSubscriptionUnitPrice.itemId billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey - cadence = newSubscriptionUnitPrice.cadence billingCycleConfiguration = newSubscriptionUnitPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitPrice.conversionRate - modelType = newSubscriptionUnitPrice.modelType - unitConfig = newSubscriptionUnitPrice.unitConfig currency = newSubscriptionUnitPrice.currency + externalPriceId = newSubscriptionUnitPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitPrice.metadata referenceId = newSubscriptionUnitPrice.referenceId additionalProperties = newSubscriptionUnitPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4084,21 +4774,21 @@ constructor( fun build(): NewSubscriptionUnitPrice = NewSubscriptionUnitPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -4735,60 +5425,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitConfig == other.unitConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitConfig=$unitConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -4796,9 +5484,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -4806,6 +5491,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -4817,17 +5525,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -4836,20 +5533,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -4871,139 +5561,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageConfig: PackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageConfig: PackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = apply { - metadata = newSubscriptionPackagePrice.metadata - externalPriceId = newSubscriptionPackagePrice.externalPriceId + cadence = newSubscriptionPackagePrice.cadence + itemId = newSubscriptionPackagePrice.itemId + modelType = newSubscriptionPackagePrice.modelType name = newSubscriptionPackagePrice.name + packageConfig = newSubscriptionPackagePrice.packageConfig billableMetricId = newSubscriptionPackagePrice.billableMetricId - itemId = newSubscriptionPackagePrice.itemId billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey - cadence = newSubscriptionPackagePrice.cadence billingCycleConfiguration = newSubscriptionPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionPackagePrice.conversionRate - modelType = newSubscriptionPackagePrice.modelType - packageConfig = newSubscriptionPackagePrice.packageConfig currency = newSubscriptionPackagePrice.currency + externalPriceId = newSubscriptionPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionPackagePrice.metadata referenceId = newSubscriptionPackagePrice.referenceId additionalProperties = newSubscriptionPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageConfig(packageConfig: PackageConfig) = apply { + this.packageConfig = packageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageConfig(packageConfig: PackageConfig) = apply { - this.packageConfig = packageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5029,23 +5813,23 @@ constructor( fun build(): NewSubscriptionPackagePrice = NewSubscriptionPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageConfig) { "`packageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -5704,56 +6488,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageConfig == other.packageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageConfig=$packageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionMatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -5765,9 +6547,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -5775,6 +6554,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -5786,17 +6588,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -5805,20 +6596,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -5840,61 +6624,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var matrixConfig: MatrixConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixConfig: MatrixConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = apply { - metadata = newSubscriptionMatrixPrice.metadata - externalPriceId = newSubscriptionMatrixPrice.externalPriceId + cadence = newSubscriptionMatrixPrice.cadence + itemId = newSubscriptionMatrixPrice.itemId + matrixConfig = newSubscriptionMatrixPrice.matrixConfig + modelType = newSubscriptionMatrixPrice.modelType name = newSubscriptionMatrixPrice.name billableMetricId = newSubscriptionMatrixPrice.billableMetricId - itemId = newSubscriptionMatrixPrice.itemId billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey - cadence = newSubscriptionMatrixPrice.cadence billingCycleConfiguration = newSubscriptionMatrixPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionMatrixPrice.invoicingCycleConfiguration conversionRate = newSubscriptionMatrixPrice.conversionRate - modelType = newSubscriptionMatrixPrice.modelType - matrixConfig = newSubscriptionMatrixPrice.matrixConfig currency = newSubscriptionMatrixPrice.currency + externalPriceId = newSubscriptionMatrixPrice.externalPriceId + fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionMatrixPrice.invoicingCycleConfiguration + metadata = newSubscriptionMatrixPrice.metadata referenceId = newSubscriptionMatrixPrice.referenceId additionalProperties = newSubscriptionMatrixPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = apply { + this.matrixConfig = matrixConfig } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -5902,77 +6686,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun matrixConfig(matrixConfig: MatrixConfig) = apply { - this.matrixConfig = matrixConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5998,23 +6876,23 @@ constructor( fun build(): NewSubscriptionMatrixPrice = NewSubscriptionMatrixPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixConfig) { + "`matrixConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixConfig) { - "`matrixConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -6106,16 +6984,13 @@ constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions - /** * Default per unit rate for any usage not bucketed into a specified * matrix_value @@ -6123,6 +6998,9 @@ constructor( @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues @@ -6140,20 +7018,28 @@ constructor( class Builder { - private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions.toMutableList() defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.toMutableList() matrixValues = matrixConfig.matrixValues.toMutableList() additionalProperties = matrixConfig.additionalProperties.toMutableMap() } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -6164,14 +7050,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified - * matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -6207,13 +7085,13 @@ constructor( fun build(): MatrixConfig = MatrixConfig( + checkNotNull(defaultUnitAmount) { + "`defaultUnitAmount` is required but was not set" + }, checkNotNull(dimensions) { "`dimensions` is required but was not set" } .toImmutable(), - checkNotNull(defaultUnitAmount) { - "`defaultUnitAmount` is required but was not set" - }, checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } @@ -6226,17 +7104,14 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -6245,6 +7120,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6258,24 +7136,19 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -6297,6 +7170,11 @@ constructor( } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6321,13 +7199,13 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { - "`unitAmount` is required but was not set" - }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { + "`unitAmount` is required but was not set" + }, additionalProperties.toImmutable(), ) } @@ -6337,17 +7215,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -6355,17 +7233,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -6830,60 +7708,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixConfig == other.matrixConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionMatrixPrice && cadence == other.cadence && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixConfig=$matrixConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionMatrixPrice{cadence=$cadence, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -6891,9 +7767,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -6901,6 +7774,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -6912,17 +7808,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -6931,20 +7816,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -6966,139 +7844,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredConfig: TieredConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredConfig: TieredConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = apply { - metadata = newSubscriptionTieredPrice.metadata - externalPriceId = newSubscriptionTieredPrice.externalPriceId + cadence = newSubscriptionTieredPrice.cadence + itemId = newSubscriptionTieredPrice.itemId + modelType = newSubscriptionTieredPrice.modelType name = newSubscriptionTieredPrice.name + tieredConfig = newSubscriptionTieredPrice.tieredConfig billableMetricId = newSubscriptionTieredPrice.billableMetricId - itemId = newSubscriptionTieredPrice.itemId billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey - cadence = newSubscriptionTieredPrice.cadence billingCycleConfiguration = newSubscriptionTieredPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPrice.conversionRate - modelType = newSubscriptionTieredPrice.modelType - tieredConfig = newSubscriptionTieredPrice.tieredConfig currency = newSubscriptionTieredPrice.currency + externalPriceId = newSubscriptionTieredPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPrice.metadata referenceId = newSubscriptionTieredPrice.referenceId additionalProperties = newSubscriptionTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredConfig(tieredConfig: TieredConfig) = apply { + this.tieredConfig = tieredConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredConfig(tieredConfig: TieredConfig) = apply { - this.tieredConfig = tieredConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7124,23 +8096,23 @@ constructor( fun build(): NewSubscriptionTieredPrice = NewSubscriptionTieredPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -7362,8 +8334,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("first_unit") private val firstUnit: Double, - @JsonProperty("last_unit") private val lastUnit: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("last_unit") private val lastUnit: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), @@ -7372,15 +8344,15 @@ constructor( /** Inclusive tier starting value */ @JsonProperty("first_unit") fun firstUnit(): Double = firstUnit + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** * Exclusive tier ending value. If null, this is treated as the last tier */ @JsonProperty("last_unit") fun lastUnit(): Optional = Optional.ofNullable(lastUnit) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -7395,32 +8367,48 @@ constructor( class Builder { private var firstUnit: Double? = null - private var lastUnit: Double? = null private var unitAmount: String? = null + private var lastUnit: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } /** Inclusive tier starting value */ fun firstUnit(firstUnit: Double) = apply { this.firstUnit = firstUnit } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + /** * Exclusive tier ending value. If null, this is treated as the last * tier */ - fun lastUnit(lastUnit: Double) = apply { this.lastUnit = lastUnit } + fun lastUnit(lastUnit: Double?) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { @@ -7449,10 +8437,10 @@ constructor( checkNotNull(firstUnit) { "`firstUnit` is required but was not set" }, - lastUnit, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + lastUnit, additionalProperties.toImmutable(), ) } @@ -7462,17 +8450,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -7903,60 +8891,59 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredConfig == other.tieredConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredConfig=$tieredConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_bps_config") + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -7964,9 +8951,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -7974,6 +8958,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -7985,17 +8992,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -8004,21 +9000,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_bps_config") - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -8040,21 +9028,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredBpsConfig: TieredBpsConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredBpsConfig: TieredBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -8062,118 +9050,212 @@ constructor( internal fun from( newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice ) = apply { - metadata = newSubscriptionTieredBpsPrice.metadata - externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + cadence = newSubscriptionTieredBpsPrice.cadence + itemId = newSubscriptionTieredBpsPrice.itemId + modelType = newSubscriptionTieredBpsPrice.modelType name = newSubscriptionTieredBpsPrice.name + tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - itemId = newSubscriptionTieredBpsPrice.itemId billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey - cadence = newSubscriptionTieredBpsPrice.cadence billingCycleConfiguration = newSubscriptionTieredBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredBpsPrice.conversionRate - modelType = newSubscriptionTieredBpsPrice.modelType - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig currency = newSubscriptionTieredBpsPrice.currency + externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredBpsPrice.metadata referenceId = newSubscriptionTieredBpsPrice.referenceId additionalProperties = newSubscriptionTieredBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { + this.tieredBpsConfig = tieredBpsConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { - this.tieredBpsConfig = tieredBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8199,23 +9281,23 @@ constructor( fun build(): NewSubscriptionTieredBpsPrice = NewSubscriptionTieredBpsPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredBpsConfig) { "`tieredBpsConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -8442,15 +9524,18 @@ constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") private val bps: Double, @JsonProperty("minimum_amount") private val minimumAmount: String, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("bps") private val bps: Double, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + @JsonProperty("bps") fun bps(): Double = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount @@ -8458,9 +9543,6 @@ constructor( @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Per-event basis point rate */ - @JsonProperty("bps") fun bps(): Double = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -8478,40 +9560,48 @@ constructor( class Builder { + private var bps: Double? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var bps: Double? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8536,11 +9626,11 @@ constructor( fun build(): Tier = Tier( + checkNotNull(bps) { "`bps` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, maximumAmount, - checkNotNull(bps) { "`bps` is required but was not set" }, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -8551,17 +9641,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -8992,56 +10082,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredBpsConfig == other.tieredBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredBpsConfig=$tieredBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredBpsPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bps_config") private val bpsConfig: BpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bps_config") private val bpsConfig: BpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -9053,9 +10141,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -9063,6 +10148,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -9074,17 +10182,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -9093,20 +10190,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -9128,59 +10218,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bpsConfig: BpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bpsConfig: BpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - metadata = newSubscriptionBpsPrice.metadata - externalPriceId = newSubscriptionBpsPrice.externalPriceId + bpsConfig = newSubscriptionBpsPrice.bpsConfig + cadence = newSubscriptionBpsPrice.cadence + itemId = newSubscriptionBpsPrice.itemId + modelType = newSubscriptionBpsPrice.modelType name = newSubscriptionBpsPrice.name billableMetricId = newSubscriptionBpsPrice.billableMetricId - itemId = newSubscriptionBpsPrice.itemId billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBpsPrice.cadence billingCycleConfiguration = newSubscriptionBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBpsPrice.conversionRate - modelType = newSubscriptionBpsPrice.modelType - bpsConfig = newSubscriptionBpsPrice.bpsConfig currency = newSubscriptionBpsPrice.currency + externalPriceId = newSubscriptionBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBpsPrice.metadata referenceId = newSubscriptionBpsPrice.referenceId additionalProperties = newSubscriptionBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -9189,75 +10277,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9283,21 +10467,21 @@ constructor( fun build(): NewSubscriptionBpsPrice = NewSubscriptionBpsPrice( - metadata, - externalPriceId, + checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -9349,10 +10533,14 @@ constructor( fun bps(bps: Double) = apply { this.bps = bps } /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9945,56 +11133,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bpsConfig == other.bpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bpsConfig=$bpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -10006,9 +11192,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -10016,6 +11199,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -10027,17 +11233,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -10046,20 +11241,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -10081,61 +11269,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkBpsConfig: BulkBpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkBpsConfig: BulkBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = apply { - metadata = newSubscriptionBulkBpsPrice.metadata - externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig + cadence = newSubscriptionBulkBpsPrice.cadence + itemId = newSubscriptionBulkBpsPrice.itemId + modelType = newSubscriptionBulkBpsPrice.modelType name = newSubscriptionBulkBpsPrice.name billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - itemId = newSubscriptionBulkBpsPrice.itemId billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBulkBpsPrice.cadence billingCycleConfiguration = newSubscriptionBulkBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkBpsPrice.conversionRate - modelType = newSubscriptionBulkBpsPrice.modelType - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig currency = newSubscriptionBulkBpsPrice.currency + externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkBpsPrice.metadata referenceId = newSubscriptionBulkBpsPrice.referenceId additionalProperties = newSubscriptionBulkBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { + this.bulkBpsConfig = bulkBpsConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -10143,77 +11331,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { - this.bulkBpsConfig = bulkBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10239,23 +11521,23 @@ constructor( fun build(): NewSubscriptionBulkBpsPrice = NewSubscriptionBulkBpsPrice( - metadata, - externalPriceId, + checkNotNull(bulkBpsConfig) { + "`bulkBpsConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkBpsConfig) { - "`bulkBpsConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -10347,21 +11629,21 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("bps") private val bps: Double, + @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + @JsonProperty("bps") fun bps(): Double = bps + /** Upper bound for tier */ @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Basis points to rate on */ - @JsonProperty("bps") fun bps(): Double = bps - /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -10379,33 +11661,41 @@ constructor( class Builder { - private var maximumAmount: String? = null private var bps: Double? = null + private var maximumAmount: String? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10430,8 +11720,8 @@ constructor( fun build(): Tier = Tier( - maximumAmount, checkNotNull(bps) { "`bps` is required but was not set" }, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -10442,17 +11732,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -11017,56 +12307,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkBpsConfig == other.bulkBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkBpsConfig=$bulkBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -11078,9 +12366,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -11088,6 +12373,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -11099,17 +12407,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -11118,20 +12415,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -11153,59 +12443,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkConfig: BulkConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkConfig: BulkConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - metadata = newSubscriptionBulkPrice.metadata - externalPriceId = newSubscriptionBulkPrice.externalPriceId + bulkConfig = newSubscriptionBulkPrice.bulkConfig + cadence = newSubscriptionBulkPrice.cadence + itemId = newSubscriptionBulkPrice.itemId + modelType = newSubscriptionBulkPrice.modelType name = newSubscriptionBulkPrice.name billableMetricId = newSubscriptionBulkPrice.billableMetricId - itemId = newSubscriptionBulkPrice.itemId billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey - cadence = newSubscriptionBulkPrice.cadence billingCycleConfiguration = newSubscriptionBulkPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkPrice.conversionRate - modelType = newSubscriptionBulkPrice.modelType - bulkConfig = newSubscriptionBulkPrice.bulkConfig currency = newSubscriptionBulkPrice.currency + externalPriceId = newSubscriptionBulkPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkPrice.metadata referenceId = newSubscriptionBulkPrice.referenceId additionalProperties = newSubscriptionBulkPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -11214,75 +12502,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11308,21 +12692,21 @@ constructor( fun build(): NewSubscriptionBulkPrice = NewSubscriptionBulkPrice( - metadata, - externalPriceId, + checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -11405,20 +12789,20 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Upper bound for this tier */ @JsonProperty("maximum_units") fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -11432,28 +12816,39 @@ constructor( class Builder { - private var maximumUnits: Double? = null private var unitAmount: String? = null + private var maximumUnits: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = apply { - this.maximumUnits = maximumUnits - } - /** Amount per unit */ fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double?) = apply { + this.maximumUnits = maximumUnits + } + + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(maximumUnits as Double?) + + /** Upper bound for this tier */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11478,10 +12873,10 @@ constructor( fun build(): Tier = Tier( - maximumUnits, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -11491,17 +12886,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -12066,61 +13461,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkConfig == other.bulkConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkConfig=$bulkConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("threshold_total_amount_config") + private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("threshold_total_amount_config") - private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("threshold_total_amount_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -12128,9 +13523,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -12138,6 +13530,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -12149,17 +13564,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -12168,22 +13572,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("threshold_total_amount_config") - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -12205,21 +13600,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -12228,122 +13623,216 @@ constructor( newSubscriptionThresholdTotalAmountPrice: NewSubscriptionThresholdTotalAmountPrice ) = apply { - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId + cadence = newSubscriptionThresholdTotalAmountPrice.cadence + itemId = newSubscriptionThresholdTotalAmountPrice.itemId + modelType = newSubscriptionThresholdTotalAmountPrice.modelType name = newSubscriptionThresholdTotalAmountPrice.name + thresholdTotalAmountConfig = + newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - itemId = newSubscriptionThresholdTotalAmountPrice.itemId billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration + conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate + currency = newSubscriptionThresholdTotalAmountPrice.currency + externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId fixedPriceQuantity = newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - currency = newSubscriptionThresholdTotalAmountPrice.currency + metadata = newSubscriptionThresholdTotalAmountPrice.metadata referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId additionalProperties = newSubscriptionThresholdTotalAmountPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: ThresholdTotalAmountConfig + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: ThresholdTotalAmountConfig - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -12369,23 +13858,23 @@ constructor( fun build(): NewSubscriptionThresholdTotalAmountPrice = NewSubscriptionThresholdTotalAmountPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(thresholdTotalAmountConfig) { "`thresholdTotalAmountConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -13010,61 +14499,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, thresholdTotalAmountConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionThresholdTotalAmountPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionThresholdTotalAmountPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_config") + private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_config") - private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_config") + fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -13072,9 +14560,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -13082,6 +14567,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -13093,17 +14601,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -13112,21 +14609,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_config") - fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -13148,21 +14637,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageConfig: TieredPackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageConfig: TieredPackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -13170,118 +14659,212 @@ constructor( internal fun from( newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice ) = apply { - metadata = newSubscriptionTieredPackagePrice.metadata - externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + cadence = newSubscriptionTieredPackagePrice.cadence + itemId = newSubscriptionTieredPackagePrice.itemId + modelType = newSubscriptionTieredPackagePrice.modelType name = newSubscriptionTieredPackagePrice.name + tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - itemId = newSubscriptionTieredPackagePrice.itemId billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey - cadence = newSubscriptionTieredPackagePrice.cadence billingCycleConfiguration = newSubscriptionTieredPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPackagePrice.conversionRate - modelType = newSubscriptionTieredPackagePrice.modelType - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig currency = newSubscriptionTieredPackagePrice.currency + externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPackagePrice.metadata referenceId = newSubscriptionTieredPackagePrice.referenceId additionalProperties = newSubscriptionTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { + this.tieredPackageConfig = tieredPackageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { - this.tieredPackageConfig = tieredPackageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -13307,23 +14890,23 @@ constructor( fun build(): NewSubscriptionTieredPackagePrice = NewSubscriptionTieredPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredPackageConfig) { "`tieredPackageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -13947,61 +15530,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageConfig == other.tieredPackageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageConfig=$tieredPackageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_minimum_config") + private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_minimum_config") - private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_minimum_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -14009,9 +15591,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -14019,6 +15598,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -14030,17 +15632,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -14049,21 +15640,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_minimum_config") - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -14085,21 +15668,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -14107,123 +15690,217 @@ constructor( internal fun from( newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice ) = apply { - metadata = newSubscriptionTieredWithMinimumPrice.metadata - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId + cadence = newSubscriptionTieredWithMinimumPrice.cadence + itemId = newSubscriptionTieredWithMinimumPrice.itemId + modelType = newSubscriptionTieredWithMinimumPrice.modelType name = newSubscriptionTieredWithMinimumPrice.name + tieredWithMinimumConfig = + newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - itemId = newSubscriptionTieredWithMinimumPrice.itemId billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration + conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate + currency = newSubscriptionTieredWithMinimumPrice.currency + externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionTieredWithMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - modelType = newSubscriptionTieredWithMinimumPrice.modelType - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - currency = newSubscriptionTieredWithMinimumPrice.currency + metadata = newSubscriptionTieredWithMinimumPrice.metadata referenceId = newSubscriptionTieredWithMinimumPrice.referenceId additionalProperties = newSubscriptionTieredWithMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + apply { + this.tieredWithMinimumConfig = tieredWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - apply { - this.tieredWithMinimumConfig = tieredWithMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -14249,23 +15926,23 @@ constructor( fun build(): NewSubscriptionTieredWithMinimumPrice = NewSubscriptionTieredWithMinimumPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithMinimumConfig) { "`tieredWithMinimumConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -14890,61 +16567,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithMinimumConfig=$tieredWithMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithPercentPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_percent_config") + private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_percent_config") - private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_percent_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -14952,9 +16628,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -14962,6 +16635,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -14973,17 +16669,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -14992,21 +16677,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_percent_config") - fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -15028,21 +16705,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithPercentConfig: UnitWithPercentConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithPercentConfig: UnitWithPercentConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -15050,120 +16727,214 @@ constructor( internal fun from( newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice ) = apply { - metadata = newSubscriptionUnitWithPercentPrice.metadata - externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + cadence = newSubscriptionUnitWithPercentPrice.cadence + itemId = newSubscriptionUnitWithPercentPrice.itemId + modelType = newSubscriptionUnitWithPercentPrice.modelType name = newSubscriptionUnitWithPercentPrice.name + unitWithPercentConfig = + newSubscriptionUnitWithPercentPrice.unitWithPercentConfig billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - itemId = newSubscriptionUnitWithPercentPrice.itemId billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithPercentPrice.cadence billingCycleConfiguration = newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - modelType = newSubscriptionUnitWithPercentPrice.modelType - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig currency = newSubscriptionUnitWithPercentPrice.currency + externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitWithPercentPrice.metadata referenceId = newSubscriptionUnitWithPercentPrice.referenceId additionalProperties = newSubscriptionUnitWithPercentPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = + apply { + this.unitWithPercentConfig = unitWithPercentConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = - apply { - this.unitWithPercentConfig = unitWithPercentConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -15189,23 +16960,23 @@ constructor( fun build(): NewSubscriptionUnitWithPercentPrice = NewSubscriptionUnitWithPercentPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithPercentConfig) { "`unitWithPercentConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -15829,61 +17600,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithPercentConfig == other.unitWithPercentConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithPercentConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithPercentPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithPercentConfig=$unitWithPercentConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithPercentPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_with_allocation_config") + private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_with_allocation_config") - private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_with_allocation_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -15891,9 +17662,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -15901,6 +17669,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -15912,17 +17703,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -15931,22 +17711,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_with_allocation_config") - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -15968,21 +17739,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -15991,123 +17762,217 @@ constructor( newSubscriptionPackageWithAllocationPrice: NewSubscriptionPackageWithAllocationPrice ) = apply { - metadata = newSubscriptionPackageWithAllocationPrice.metadata - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId + cadence = newSubscriptionPackageWithAllocationPrice.cadence + itemId = newSubscriptionPackageWithAllocationPrice.itemId + modelType = newSubscriptionPackageWithAllocationPrice.modelType name = newSubscriptionPackageWithAllocationPrice.name + packageWithAllocationConfig = + newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig billableMetricId = newSubscriptionPackageWithAllocationPrice.billableMetricId - itemId = newSubscriptionPackageWithAllocationPrice.itemId billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate + currency = newSubscriptionPackageWithAllocationPrice.currency + externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionPackageWithAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - modelType = newSubscriptionPackageWithAllocationPrice.modelType - packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - currency = newSubscriptionPackageWithAllocationPrice.currency + metadata = newSubscriptionPackageWithAllocationPrice.metadata referenceId = newSubscriptionPackageWithAllocationPrice.referenceId additionalProperties = newSubscriptionPackageWithAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16133,23 +17998,23 @@ constructor( fun build(): NewSubscriptionPackageWithAllocationPrice = NewSubscriptionPackageWithAllocationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageWithAllocationConfig) { "`packageWithAllocationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -16775,61 +18640,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageWithAllocationConfig == other.packageWithAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageWithAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackageWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageWithAllocationConfig=$packageWithAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackageWithAllocationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTierWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_proration_config") + private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_proration_config") - private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_proration_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -16837,9 +18702,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -16847,6 +18709,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -16858,17 +18743,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -16877,22 +18751,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_proration_config") - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -16914,21 +18779,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -16936,122 +18801,216 @@ constructor( internal fun from( newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice ) = apply { - metadata = newSubscriptionTierWithProrationPrice.metadata - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId + cadence = newSubscriptionTierWithProrationPrice.cadence + itemId = newSubscriptionTierWithProrationPrice.itemId + modelType = newSubscriptionTierWithProrationPrice.modelType name = newSubscriptionTierWithProrationPrice.name + tieredWithProrationConfig = + newSubscriptionTierWithProrationPrice.tieredWithProrationConfig billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - itemId = newSubscriptionTierWithProrationPrice.itemId billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTierWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionTierWithProrationPrice.conversionRate + currency = newSubscriptionTierWithProrationPrice.currency + externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionTierWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTierWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionTierWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - modelType = newSubscriptionTierWithProrationPrice.modelType - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - currency = newSubscriptionTierWithProrationPrice.currency + metadata = newSubscriptionTierWithProrationPrice.metadata referenceId = newSubscriptionTierWithProrationPrice.referenceId additionalProperties = newSubscriptionTierWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithProrationConfig( + tieredWithProrationConfig: TieredWithProrationConfig + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredWithProrationConfig( - tieredWithProrationConfig: TieredWithProrationConfig - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -17077,23 +19036,23 @@ constructor( fun build(): NewSubscriptionTierWithProrationPrice = NewSubscriptionTierWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithProrationConfig) { "`tieredWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -17718,61 +19677,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithProrationConfig == other.tieredWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTierWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithProrationConfig=$tieredWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTierWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_proration_config") + private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_proration_config") - private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -17780,9 +19738,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -17790,6 +19745,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -17801,17 +19779,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -17820,21 +19787,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_proration_config") - fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -17856,21 +19815,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithProrationConfig: UnitWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithProrationConfig: UnitWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -17878,123 +19837,217 @@ constructor( internal fun from( newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice ) = apply { - metadata = newSubscriptionUnitWithProrationPrice.metadata - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId + cadence = newSubscriptionUnitWithProrationPrice.cadence + itemId = newSubscriptionUnitWithProrationPrice.itemId + modelType = newSubscriptionUnitWithProrationPrice.modelType name = newSubscriptionUnitWithProrationPrice.name + unitWithProrationConfig = + newSubscriptionUnitWithProrationPrice.unitWithProrationConfig billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - itemId = newSubscriptionUnitWithProrationPrice.itemId billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionUnitWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate + currency = newSubscriptionUnitWithProrationPrice.currency + externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionUnitWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - modelType = newSubscriptionUnitWithProrationPrice.modelType - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - currency = newSubscriptionUnitWithProrationPrice.currency + metadata = newSubscriptionUnitWithProrationPrice.metadata referenceId = newSubscriptionUnitWithProrationPrice.referenceId additionalProperties = newSubscriptionUnitWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + apply { + this.unitWithProrationConfig = unitWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - apply { - this.unitWithProrationConfig = unitWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -18020,23 +20073,23 @@ constructor( fun build(): NewSubscriptionUnitWithProrationPrice = NewSubscriptionUnitWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithProrationConfig) { "`unitWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -18661,57 +20714,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithProrationConfig == other.unitWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithProrationConfig=$unitWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_allocation_config") + private val groupedAllocationConfig: GroupedAllocationConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_allocation_config") - private val groupedAllocationConfig: GroupedAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_allocation_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -18723,9 +20775,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -18733,6 +20782,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -18744,17 +20816,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -18763,21 +20824,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_allocation_config") - fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -18799,21 +20852,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedAllocationConfig: GroupedAllocationConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedAllocationConfig: GroupedAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -18821,43 +20874,44 @@ constructor( internal fun from( newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice ) = apply { - metadata = newSubscriptionGroupedAllocationPrice.metadata - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId + cadence = newSubscriptionGroupedAllocationPrice.cadence + groupedAllocationConfig = + newSubscriptionGroupedAllocationPrice.groupedAllocationConfig + itemId = newSubscriptionGroupedAllocationPrice.itemId + modelType = newSubscriptionGroupedAllocationPrice.modelType name = newSubscriptionGroupedAllocationPrice.name billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - itemId = newSubscriptionGroupedAllocationPrice.itemId billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate + currency = newSubscriptionGroupedAllocationPrice.currency + externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - modelType = newSubscriptionGroupedAllocationPrice.modelType - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - currency = newSubscriptionGroupedAllocationPrice.currency + metadata = newSubscriptionGroupedAllocationPrice.metadata referenceId = newSubscriptionGroupedAllocationPrice.referenceId additionalProperties = newSubscriptionGroupedAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + apply { + this.groupedAllocationConfig = groupedAllocationConfig + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -18866,78 +20920,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - apply { - this.groupedAllocationConfig = groupedAllocationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -18963,23 +21110,23 @@ constructor( fun build(): NewSubscriptionGroupedAllocationPrice = NewSubscriptionGroupedAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedAllocationConfig) { + "`groupedAllocationConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedAllocationConfig) { - "`groupedAllocationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -19604,57 +21751,57 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedAllocationConfig == other.groupedAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && cadence == other.cadence && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedAllocationConfig=$groupedAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedAllocationPrice{cadence=$cadence, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_with_prorated_minimum_config") + private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_prorated_minimum_config") - private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_with_prorated_minimum_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -19666,9 +21813,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -19676,6 +21820,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -19687,17 +21854,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -19706,22 +21862,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_prorated_minimum_config") - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -19743,23 +21890,23 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedWithProratedMinimumConfig: + GroupedWithProratedMinimumConfig? = + null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithProratedMinimumConfig: - GroupedWithProratedMinimumConfig? = - null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -19768,50 +21915,52 @@ constructor( newSubscriptionGroupedWithProratedMinimumPrice: NewSubscriptionGroupedWithProratedMinimumPrice ) = apply { - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId + cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence + groupedWithProratedMinimumConfig = + newSubscriptionGroupedWithProratedMinimumPrice + .groupedWithProratedMinimumConfig + itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId + modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType name = newSubscriptionGroupedWithProratedMinimumPrice.name billableMetricId = newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId billedInAdvance = newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration + conversionRate = + newSubscriptionGroupedWithProratedMinimumPrice.conversionRate + currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + externalPriceId = + newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedWithProratedMinimumPrice .invoicingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId additionalProperties = newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -19819,79 +21968,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { - this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19917,23 +22158,23 @@ constructor( fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = NewSubscriptionGroupedWithProratedMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedWithProratedMinimumConfig) { + "`groupedWithProratedMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithProratedMinimumConfig) { - "`groupedWithProratedMinimumConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -20560,57 +22801,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && cadence == other.cadence && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithProratedMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithProratedMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedWithProratedMinimumPrice{cadence=$cadence, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_with_proration_config") + private val bulkWithProrationConfig: BulkWithProrationConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_with_proration_config") - private val bulkWithProrationConfig: BulkWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_with_proration_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -20622,9 +22862,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -20632,6 +22869,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -20643,17 +22903,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -20662,21 +22911,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_with_proration_config") - fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -20698,21 +22939,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkWithProrationConfig: BulkWithProrationConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkWithProrationConfig: BulkWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -20720,43 +22961,44 @@ constructor( internal fun from( newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice ) = apply { - metadata = newSubscriptionBulkWithProrationPrice.metadata - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId + bulkWithProrationConfig = + newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig + cadence = newSubscriptionBulkWithProrationPrice.cadence + itemId = newSubscriptionBulkWithProrationPrice.itemId + modelType = newSubscriptionBulkWithProrationPrice.modelType name = newSubscriptionBulkWithProrationPrice.name billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - itemId = newSubscriptionBulkWithProrationPrice.itemId billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionBulkWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate + currency = newSubscriptionBulkWithProrationPrice.currency + externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionBulkWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionBulkWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - modelType = newSubscriptionBulkWithProrationPrice.modelType - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - currency = newSubscriptionBulkWithProrationPrice.currency + metadata = newSubscriptionBulkWithProrationPrice.metadata referenceId = newSubscriptionBulkWithProrationPrice.referenceId additionalProperties = newSubscriptionBulkWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + apply { + this.bulkWithProrationConfig = bulkWithProrationConfig + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -20765,78 +23007,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - apply { - this.bulkWithProrationConfig = bulkWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20862,23 +23197,23 @@ constructor( fun build(): NewSubscriptionBulkWithProrationPrice = NewSubscriptionBulkWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(bulkWithProrationConfig) { + "`bulkWithProrationConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkWithProrationConfig) { - "`bulkWithProrationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -21503,17 +23838,17 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkWithProrationConfig == other.bulkWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } @@ -21522,17 +23857,17 @@ constructor( return true } - return /* spotless:off */ other is AddPrice && priceId == other.priceId && externalPriceId == other.externalPriceId && price == other.price && startDate == other.startDate && endDate == other.endDate && planPhaseOrder == other.planPhaseOrder && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && discounts == other.discounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddPrice && discounts == other.discounts && endDate == other.endDate && externalPriceId == other.externalPriceId && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && price == other.price && priceId == other.priceId && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, externalPriceId, price, startDate, endDate, planPhaseOrder, minimumAmount, maximumAmount, discounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(discounts, endDate, externalPriceId, maximumAmount, minimumAmount, planPhaseOrder, price, priceId, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AddPrice{priceId=$priceId, externalPriceId=$externalPriceId, price=$price, startDate=$startDate, endDate=$endDate, planPhaseOrder=$planPhaseOrder, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, discounts=$discounts, additionalProperties=$additionalProperties}" + "AddPrice{discounts=$discounts, endDate=$endDate, externalPriceId=$externalPriceId, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, price=$price, priceId=$priceId, startDate=$startDate, additionalProperties=$additionalProperties}" } class BillingCycleAlignment @@ -21669,13 +24004,39 @@ constructor( * The month on which the billing cycle is anchored (e.g. a quarterly price anchored in * February would have cycles starting February, May, August, and November). */ - fun month(month: Long) = apply { this.month = month } + fun month(month: Long?) = apply { this.month = month } + + /** + * The month on which the billing cycle is anchored (e.g. a quarterly price anchored in + * February would have cycles starting February, May, August, and November). + */ + fun month(month: Long) = month(month as Long?) + + /** + * The month on which the billing cycle is anchored (e.g. a quarterly price anchored in + * February would have cycles starting February, May, August, and November). + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun month(month: Optional) = month(month.orElse(null) as Long?) + + /** + * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored + * on 2021 would have cycles starting on 2021, 2023, 2025, etc.). + */ + fun year(year: Long?) = apply { this.year = year } /** * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored * on 2021 would have cycles starting on 2021, 2023, 2025, etc.). */ - fun year(year: Long) = apply { this.year = year } + fun year(year: Long) = year(year as Long?) + + /** + * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle anchored + * on 2021 would have cycles starting on 2021, 2023, 2025, etc.). + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun year(year: Optional) = year(year.orElse(null) as Long?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -21808,19 +24169,19 @@ constructor( class RemovePrice @JsonCreator private constructor( - @JsonProperty("price_id") private val priceId: String?, @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("price_id") private val priceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the price to remove on the subscription. */ - @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) - /** The external price id of the price to remove on the subscription. */ @JsonProperty("external_price_id") fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the price to remove on the subscription. */ + @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -21834,25 +24195,32 @@ constructor( class Builder { - private var priceId: String? = null private var externalPriceId: String? = null + private var priceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(removePrice: RemovePrice) = apply { - priceId = removePrice.priceId externalPriceId = removePrice.externalPriceId + priceId = removePrice.priceId additionalProperties = removePrice.additionalProperties.toMutableMap() } - /** The id of the price to remove on the subscription. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } - /** The external price id of the price to remove on the subscription. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** The external price id of the price to remove on the subscription. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** The id of the price to remove on the subscription. */ + fun priceId(priceId: String?) = apply { this.priceId = priceId } + + /** The id of the price to remove on the subscription. */ + fun priceId(priceId: Optional) = priceId(priceId.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -21874,8 +24242,8 @@ constructor( fun build(): RemovePrice = RemovePrice( - priceId, externalPriceId, + priceId, additionalProperties.toImmutable(), ) } @@ -21885,17 +24253,17 @@ constructor( return true } - return /* spotless:off */ other is RemovePrice && priceId == other.priceId && externalPriceId == other.externalPriceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RemovePrice && externalPriceId == other.externalPriceId && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, externalPriceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalPriceId, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RemovePrice{priceId=$priceId, externalPriceId=$externalPriceId, additionalProperties=$additionalProperties}" + "RemovePrice{externalPriceId=$externalPriceId, priceId=$priceId, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -22184,18 +24552,24 @@ constructor( class NewPercentageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("percentage_discount") private val percentageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("percentage_discount") + fun percentageDiscount(): Double = percentageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -22203,12 +24577,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("percentage_discount") - fun percentageDiscount(): Double = percentageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22222,22 +24590,26 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var percentageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newPercentageDiscount: NewPercentageDiscount) = apply { - appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newPercentageDiscount.isInvoiceLevel adjustmentType = newPercentageDiscount.adjustmentType + appliesToPriceIds = newPercentageDiscount.appliesToPriceIds.toMutableList() percentageDiscount = newPercentageDiscount.percentageDiscount + isInvoiceLevel = newPercentageDiscount.isInvoiceLevel additionalProperties = newPercentageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22249,21 +24621,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun percentageDiscount(percentageDiscount: Double) = apply { + this.percentageDiscount = percentageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun percentageDiscount(percentageDiscount: Double) = apply { - this.percentageDiscount = percentageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22289,17 +24672,17 @@ constructor( fun build(): NewPercentageDiscount = NewPercentageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(percentageDiscount) { "`percentageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22361,35 +24744,40 @@ constructor( return true } - return /* spotless:off */ other is NewPercentageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPercentageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && percentageDiscount == other.percentageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, percentageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPercentageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "NewPercentageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, percentageDiscount=$percentageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewUsageDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("usage_discount") private val usageDiscount: Double, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -22397,11 +24785,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("usage_discount") fun usageDiscount(): Double = usageDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22415,21 +24798,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var usageDiscount: Double? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newUsageDiscount: NewUsageDiscount) = apply { - appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newUsageDiscount.isInvoiceLevel adjustmentType = newUsageDiscount.adjustmentType + appliesToPriceIds = newUsageDiscount.appliesToPriceIds.toMutableList() usageDiscount = newUsageDiscount.usageDiscount + isInvoiceLevel = newUsageDiscount.isInvoiceLevel additionalProperties = newUsageDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22441,21 +24828,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun usageDiscount(usageDiscount: Double) = apply { + this.usageDiscount = usageDiscount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun usageDiscount(usageDiscount: Double) = apply { - this.usageDiscount = usageDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22481,17 +24879,17 @@ constructor( fun build(): NewUsageDiscount = NewUsageDiscount( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(usageDiscount) { "`usageDiscount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22553,31 +24951,36 @@ constructor( return true } - return /* spotless:off */ other is NewUsageDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewUsageDiscount && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && usageDiscount == other.usageDiscount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, usageDiscount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewUsageDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "NewUsageDiscount{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, usageDiscount=$usageDiscount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewAmountDiscount @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, @JsonProperty("amount_discount") private val amountDiscount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + + @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds @@ -22589,11 +24992,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22607,21 +25005,29 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null + private var appliesToPriceIds: MutableList? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newAmountDiscount: NewAmountDiscount) = apply { - appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() - isInvoiceLevel = newAmountDiscount.isInvoiceLevel adjustmentType = newAmountDiscount.adjustmentType amountDiscount = newAmountDiscount.amountDiscount + appliesToPriceIds = newAmountDiscount.appliesToPriceIds.toMutableList() + isInvoiceLevel = newAmountDiscount.isInvoiceLevel additionalProperties = newAmountDiscount.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + + fun amountDiscount(amountDiscount: String) = apply { + this.amountDiscount = amountDiscount + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22637,17 +25043,24 @@ constructor( * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22673,17 +25086,17 @@ constructor( fun build(): NewAmountDiscount = NewAmountDiscount( - checkNotNull(appliesToPriceIds) { - "`appliesToPriceIds` is required but was not set" - } - .toImmutable(), - isInvoiceLevel, checkNotNull(adjustmentType) { "`adjustmentType` is required but was not set" }, checkNotNull(amountDiscount) { "`amountDiscount` is required but was not set" }, + checkNotNull(appliesToPriceIds) { + "`appliesToPriceIds` is required but was not set" + } + .toImmutable(), + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22745,36 +25158,44 @@ constructor( return true } - return /* spotless:off */ other is NewAmountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewAmountDiscount && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewAmountDiscount{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "NewAmountDiscount{adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMinimum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, - @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("item_id") private val itemId: String, + @JsonProperty("minimum_amount") private val minimumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -22782,14 +25203,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount - - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") fun itemId(): String = itemId - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -22803,23 +25216,27 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null - private var minimumAmount: String? = null + private var appliesToPriceIds: MutableList? = null private var itemId: String? = null + private var minimumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMinimum: NewMinimum) = apply { - appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMinimum.isInvoiceLevel adjustmentType = newMinimum.adjustmentType - minimumAmount = newMinimum.minimumAmount + appliesToPriceIds = newMinimum.appliesToPriceIds.toMutableList() itemId = newMinimum.itemId + minimumAmount = newMinimum.minimumAmount + isInvoiceLevel = newMinimum.isInvoiceLevel additionalProperties = newMinimum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -22831,24 +25248,35 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun minimumAmount(minimumAmount: String) = apply { + this.minimumAmount = minimumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } - - fun minimumAmount(minimumAmount: String) = apply { - this.minimumAmount = minimumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22874,18 +25302,18 @@ constructor( fun build(): NewMinimum = NewMinimum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, - checkNotNull(itemId) { "`itemId` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -22947,35 +25375,40 @@ constructor( return true } - return /* spotless:off */ other is NewMinimum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMinimum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && itemId == other.itemId && minimumAmount == other.minimumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, itemId, minimumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMinimum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "NewMinimum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, itemId=$itemId, minimumAmount=$minimumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewMaximum @JsonCreator private constructor( - @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, - @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonProperty("adjustment_type") private val adjustmentType: AdjustmentType, + @JsonProperty("applies_to_price_ids") private val appliesToPriceIds: List, @JsonProperty("maximum_amount") private val maximumAmount: String, + @JsonProperty("is_invoice_level") private val isInvoiceLevel: Boolean?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + @JsonProperty("adjustment_type") + fun adjustmentType(): AdjustmentType = adjustmentType + /** The set of price IDs to which this adjustment applies. */ @JsonProperty("applies_to_price_ids") fun appliesToPriceIds(): List = appliesToPriceIds + @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount + /** * When false, this adjustment will be applied to a single price. Otherwise, it will * be applied at the invoice level, possibly to multiple prices. @@ -22983,11 +25416,6 @@ constructor( @JsonProperty("is_invoice_level") fun isInvoiceLevel(): Optional = Optional.ofNullable(isInvoiceLevel) - @JsonProperty("adjustment_type") - fun adjustmentType(): AdjustmentType = adjustmentType - - @JsonProperty("maximum_amount") fun maximumAmount(): String = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -23001,21 +25429,25 @@ constructor( class Builder { - private var appliesToPriceIds: MutableList? = null - private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null + private var appliesToPriceIds: MutableList? = null private var maximumAmount: String? = null + private var isInvoiceLevel: Boolean? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newMaximum: NewMaximum) = apply { - appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() - isInvoiceLevel = newMaximum.isInvoiceLevel adjustmentType = newMaximum.adjustmentType + appliesToPriceIds = newMaximum.appliesToPriceIds.toMutableList() maximumAmount = newMaximum.maximumAmount + isInvoiceLevel = newMaximum.isInvoiceLevel additionalProperties = newMaximum.additionalProperties.toMutableMap() } + fun adjustmentType(adjustmentType: AdjustmentType) = apply { + this.adjustmentType = adjustmentType + } + /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { this.appliesToPriceIds = appliesToPriceIds.toMutableList() @@ -23027,21 +25459,32 @@ constructor( (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } + fun maximumAmount(maximumAmount: String) = apply { + this.maximumAmount = maximumAmount + } + /** * When false, this adjustment will be applied to a single price. Otherwise, it * will be applied at the invoice level, possibly to multiple prices. */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = apply { + fun isInvoiceLevel(isInvoiceLevel: Boolean?) = apply { this.isInvoiceLevel = isInvoiceLevel } - fun adjustmentType(adjustmentType: AdjustmentType) = apply { - this.adjustmentType = adjustmentType - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(isInvoiceLevel as Boolean?) - fun maximumAmount(maximumAmount: String) = apply { - this.maximumAmount = maximumAmount - } + /** + * When false, this adjustment will be applied to a single price. Otherwise, it + * will be applied at the invoice level, possibly to multiple prices. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isInvoiceLevel(isInvoiceLevel: Optional) = + isInvoiceLevel(isInvoiceLevel.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23067,17 +25510,17 @@ constructor( fun build(): NewMaximum = NewMaximum( + checkNotNull(adjustmentType) { + "`adjustmentType` is required but was not set" + }, checkNotNull(appliesToPriceIds) { "`appliesToPriceIds` is required but was not set" } .toImmutable(), - isInvoiceLevel, - checkNotNull(adjustmentType) { - "`adjustmentType` is required but was not set" - }, checkNotNull(maximumAmount) { "`maximumAmount` is required but was not set" }, + isInvoiceLevel, additionalProperties.toImmutable(), ) } @@ -23139,17 +25582,17 @@ constructor( return true } - return /* spotless:off */ other is NewMaximum && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewMaximum && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && maximumAmount == other.maximumAmount && isInvoiceLevel == other.isInvoiceLevel && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, isInvoiceLevel, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(adjustmentType, appliesToPriceIds, maximumAmount, isInvoiceLevel, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewMaximum{appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "NewMaximum{adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, maximumAmount=$maximumAmount, isInvoiceLevel=$isInvoiceLevel, additionalProperties=$additionalProperties}" } } @@ -23175,42 +25618,36 @@ constructor( class ReplacePrice @JsonCreator private constructor( - @JsonProperty("price_id") private val priceId: String?, + @JsonProperty("replaces_price_id") private val replacesPriceId: String, + @JsonProperty("discounts") private val discounts: List?, @JsonProperty("external_price_id") private val externalPriceId: String?, - @JsonProperty("price") private val price: Price?, @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("replaces_price_id") private val replacesPriceId: String, - @JsonProperty("minimum_amount") private val minimumAmount: String?, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("discounts") private val discounts: List?, + @JsonProperty("minimum_amount") private val minimumAmount: String?, + @JsonProperty("price") private val price: Price?, + @JsonProperty("price_id") private val priceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The id of the price to add to the subscription. */ - @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) + /** The id of the price on the plan to replace in the subscription. */ + @JsonProperty("replaces_price_id") fun replacesPriceId(): String = replacesPriceId + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + @JsonProperty("discounts") + fun discounts(): Optional> = Optional.ofNullable(discounts) /** The external price id of the price to add to the subscription. */ @JsonProperty("external_price_id") fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) - /** The definition of a new price to create and add to the subscription. */ - @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) - /** The new quantity of the price, if the price is a fixed price. */ @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Optional = Optional.ofNullable(fixedPriceQuantity) - /** The id of the price on the plan to replace in the subscription. */ - @JsonProperty("replaces_price_id") fun replacesPriceId(): String = replacesPriceId - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the - * replacement price. - */ - @JsonProperty("minimum_amount") - fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) - /** * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the * replacement price. @@ -23219,11 +25656,17 @@ constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the * replacement price. */ - @JsonProperty("discounts") - fun discounts(): Optional> = Optional.ofNullable(discounts) + @JsonProperty("minimum_amount") + fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + + /** The definition of a new price to create and add to the subscription. */ + @JsonProperty("price") fun price(): Optional = Optional.ofNullable(price) + + /** The id of the price to add to the subscription. */ + @JsonProperty("price_id") fun priceId(): Optional = Optional.ofNullable(priceId) @JsonAnyGetter @ExcludeMissing @@ -23238,39 +25681,110 @@ constructor( class Builder { - private var priceId: String? = null + private var replacesPriceId: String? = null + private var discounts: MutableList? = null private var externalPriceId: String? = null - private var price: Price? = null private var fixedPriceQuantity: Double? = null - private var replacesPriceId: String? = null - private var minimumAmount: String? = null private var maximumAmount: String? = null - private var discounts: MutableList? = null + private var minimumAmount: String? = null + private var price: Price? = null + private var priceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(replacePrice: ReplacePrice) = apply { - priceId = replacePrice.priceId + replacesPriceId = replacePrice.replacesPriceId + discounts = replacePrice.discounts?.toMutableList() externalPriceId = replacePrice.externalPriceId - price = replacePrice.price fixedPriceQuantity = replacePrice.fixedPriceQuantity - replacesPriceId = replacePrice.replacesPriceId - minimumAmount = replacePrice.minimumAmount maximumAmount = replacePrice.maximumAmount - discounts = replacePrice.discounts?.toMutableList() + minimumAmount = replacePrice.minimumAmount + price = replacePrice.price + priceId = replacePrice.priceId additionalProperties = replacePrice.additionalProperties.toMutableMap() } - /** The id of the price to add to the subscription. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } + /** The id of the price on the plan to replace in the subscription. */ + fun replacesPriceId(replacesPriceId: String) = apply { + this.replacesPriceId = replacesPriceId + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun discounts(discounts: List?) = apply { + this.discounts = discounts?.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun discounts(discounts: Optional>) = discounts(discounts.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } /** The external price id of the price to add to the subscription. */ - fun externalPriceId(externalPriceId: String) = apply { + fun externalPriceId(externalPriceId: String?) = apply { this.externalPriceId = externalPriceId } + /** The external price id of the price to add to the subscription. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** The new quantity of the price, if the price is a fixed price. */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The new quantity of the price, if the price is a fixed price. */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** The new quantity of the price, if the price is a fixed price. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the + * replacement price. + */ + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the + * replacement price. + */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the + * replacement price. + */ + fun minimumAmount(minimumAmount: String?) = apply { this.minimumAmount = minimumAmount } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the + * replacement price. + */ + fun minimumAmount(minimumAmount: Optional) = + minimumAmount(minimumAmount.orElse(null)) + + /** The definition of a new price to create and add to the subscription. */ + fun price(price: Price?) = apply { this.price = price } + /** The definition of a new price to create and add to the subscription. */ - fun price(price: Price) = apply { this.price = price } + fun price(price: Optional) = price(price.orElse(null)) fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) @@ -23392,43 +25906,11 @@ constructor( ) } - /** The new quantity of the price, if the price is a fixed price. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The id of the price on the plan to replace in the subscription. */ - fun replacesPriceId(replacesPriceId: String) = apply { - this.replacesPriceId = replacesPriceId - } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for the - * replacement price. - */ - fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for the - * replacement price. - */ - fun maximumAmount(maximumAmount: String) = apply { this.maximumAmount = maximumAmount } - - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the - * replacement price. - */ - fun discounts(discounts: List) = apply { - this.discounts = discounts.toMutableList() - } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: String?) = apply { this.priceId = priceId } - /** - * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the - * replacement price. - */ - fun addDiscount(discount: Discount) = apply { - discounts = (discounts ?: mutableListOf()).apply { add(discount) } - } + /** The id of the price to add to the subscription. */ + fun priceId(priceId: Optional) = priceId(priceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23451,16 +25933,16 @@ constructor( fun build(): ReplacePrice = ReplacePrice( - priceId, - externalPriceId, - price, - fixedPriceQuantity, checkNotNull(replacesPriceId) { "`replacesPriceId` is required but was not set" }, - minimumAmount, - maximumAmount, discounts?.toImmutable(), + externalPriceId, + fixedPriceQuantity, + maximumAmount, + minimumAmount, + price, + priceId, additionalProperties.toImmutable(), ) } @@ -23470,15 +25952,19 @@ constructor( @JsonCreator private constructor( @JsonProperty("discount_type") private val discountType: DiscountType, + @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonProperty("percentage_discount") private val percentageDiscount: Double?, @JsonProperty("usage_discount") private val usageDiscount: Double?, - @JsonProperty("amount_discount") private val amountDiscount: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @JsonProperty("discount_type") fun discountType(): DiscountType = discountType + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) + /** * Only available if discount_type is `percentage`. This is a number between 0 and 1. */ @@ -23492,10 +25978,6 @@ constructor( @JsonProperty("usage_discount") fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") - fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -23510,17 +25992,17 @@ constructor( class Builder { private var discountType: DiscountType? = null + private var amountDiscount: String? = null private var percentageDiscount: Double? = null private var usageDiscount: Double? = null - private var amountDiscount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(discount: Discount) = apply { discountType = discount.discountType + amountDiscount = discount.amountDiscount percentageDiscount = discount.percentageDiscount usageDiscount = discount.usageDiscount - amountDiscount = discount.amountDiscount additionalProperties = discount.additionalProperties.toMutableMap() } @@ -23528,26 +26010,59 @@ constructor( this.discountType = discountType } + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: String?) = apply { + this.amountDiscount = amountDiscount + } + + /** Only available if discount_type is `amount`. */ + fun amountDiscount(amountDiscount: Optional) = + amountDiscount(amountDiscount.orElse(null)) + /** * Only available if discount_type is `percentage`. This is a number between 0 * and 1. */ - fun percentageDiscount(percentageDiscount: Double) = apply { + fun percentageDiscount(percentageDiscount: Double?) = apply { this.percentageDiscount = percentageDiscount } + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(percentageDiscount as Double?) + + /** + * Only available if discount_type is `percentage`. This is a number between 0 + * and 1. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun percentageDiscount(percentageDiscount: Optional) = + percentageDiscount(percentageDiscount.orElse(null) as Double?) + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for */ - fun usageDiscount(usageDiscount: Double) = apply { + fun usageDiscount(usageDiscount: Double?) = apply { this.usageDiscount = usageDiscount } - /** Only available if discount_type is `amount`. */ - fun amountDiscount(amountDiscount: String) = apply { - this.amountDiscount = amountDiscount - } + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + fun usageDiscount(usageDiscount: Double) = usageDiscount(usageDiscount as Double?) + + /** + * Only available if discount_type is `usage`. Number of usage units that this + * discount is for + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun usageDiscount(usageDiscount: Optional) = + usageDiscount(usageDiscount.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23574,9 +26089,9 @@ constructor( fun build(): Discount = Discount( checkNotNull(discountType) { "`discountType` is required but was not set" }, + amountDiscount, percentageDiscount, usageDiscount, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -23649,17 +26164,17 @@ constructor( return true } - return /* spotless:off */ other is Discount && discountType == other.discountType && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Discount && discountType == other.discountType && amountDiscount == other.amountDiscount && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, usageDiscount, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, percentageDiscount, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Discount{discountType=$discountType, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "Discount{discountType=$discountType, amountDiscount=$amountDiscount, percentageDiscount=$percentageDiscount, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } /** The definition of a new price to create and add to the subscription. */ @@ -24448,43 +26963,41 @@ constructor( class NewSubscriptionUnitPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_config") private val unitConfig: UnitConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -24492,9 +27005,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -24502,6 +27012,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -24513,17 +27046,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -24532,20 +27054,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_config") fun unitConfig(): UnitConfig = unitConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -24567,136 +27082,230 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitConfig: UnitConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitConfig: UnitConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionUnitPrice: NewSubscriptionUnitPrice) = apply { - metadata = newSubscriptionUnitPrice.metadata - externalPriceId = newSubscriptionUnitPrice.externalPriceId + cadence = newSubscriptionUnitPrice.cadence + itemId = newSubscriptionUnitPrice.itemId + modelType = newSubscriptionUnitPrice.modelType name = newSubscriptionUnitPrice.name + unitConfig = newSubscriptionUnitPrice.unitConfig billableMetricId = newSubscriptionUnitPrice.billableMetricId - itemId = newSubscriptionUnitPrice.itemId billedInAdvance = newSubscriptionUnitPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey - cadence = newSubscriptionUnitPrice.cadence billingCycleConfiguration = newSubscriptionUnitPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitPrice.conversionRate - modelType = newSubscriptionUnitPrice.modelType - unitConfig = newSubscriptionUnitPrice.unitConfig currency = newSubscriptionUnitPrice.currency + externalPriceId = newSubscriptionUnitPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitPrice.metadata referenceId = newSubscriptionUnitPrice.referenceId additionalProperties = newSubscriptionUnitPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitConfig(unitConfig: UnitConfig) = apply { this.unitConfig = unitConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -24722,21 +27331,21 @@ constructor( fun build(): NewSubscriptionUnitPrice = NewSubscriptionUnitPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, + checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(unitConfig) { "`unitConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -25373,60 +27982,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitConfig == other.unitConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitConfig=$unitConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_config") private val packageConfig: PackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -25434,9 +28041,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -25444,6 +28048,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -25455,17 +28082,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -25474,20 +28090,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_config") fun packageConfig(): PackageConfig = packageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -25509,139 +28118,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageConfig: PackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageConfig: PackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionPackagePrice: NewSubscriptionPackagePrice) = apply { - metadata = newSubscriptionPackagePrice.metadata - externalPriceId = newSubscriptionPackagePrice.externalPriceId + cadence = newSubscriptionPackagePrice.cadence + itemId = newSubscriptionPackagePrice.itemId + modelType = newSubscriptionPackagePrice.modelType name = newSubscriptionPackagePrice.name + packageConfig = newSubscriptionPackagePrice.packageConfig billableMetricId = newSubscriptionPackagePrice.billableMetricId - itemId = newSubscriptionPackagePrice.itemId billedInAdvance = newSubscriptionPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey - cadence = newSubscriptionPackagePrice.cadence billingCycleConfiguration = newSubscriptionPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionPackagePrice.conversionRate - modelType = newSubscriptionPackagePrice.modelType - packageConfig = newSubscriptionPackagePrice.packageConfig currency = newSubscriptionPackagePrice.currency + externalPriceId = newSubscriptionPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionPackagePrice.metadata referenceId = newSubscriptionPackagePrice.referenceId additionalProperties = newSubscriptionPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageConfig(packageConfig: PackageConfig) = apply { + this.packageConfig = packageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageConfig(packageConfig: PackageConfig) = apply { - this.packageConfig = packageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -25667,23 +28370,23 @@ constructor( fun build(): NewSubscriptionPackagePrice = NewSubscriptionPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageConfig) { "`packageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -26342,56 +29045,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageConfig == other.packageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageConfig=$packageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionMatrixPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("matrix_config") private val matrixConfig: MatrixConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -26403,9 +29104,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -26413,6 +29111,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -26424,17 +29145,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -26443,20 +29153,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("matrix_config") fun matrixConfig(): MatrixConfig = matrixConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -26478,61 +29181,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var matrixConfig: MatrixConfig? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var matrixConfig: MatrixConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionMatrixPrice: NewSubscriptionMatrixPrice) = apply { - metadata = newSubscriptionMatrixPrice.metadata - externalPriceId = newSubscriptionMatrixPrice.externalPriceId + cadence = newSubscriptionMatrixPrice.cadence + itemId = newSubscriptionMatrixPrice.itemId + matrixConfig = newSubscriptionMatrixPrice.matrixConfig + modelType = newSubscriptionMatrixPrice.modelType name = newSubscriptionMatrixPrice.name billableMetricId = newSubscriptionMatrixPrice.billableMetricId - itemId = newSubscriptionMatrixPrice.itemId billedInAdvance = newSubscriptionMatrixPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey - cadence = newSubscriptionMatrixPrice.cadence billingCycleConfiguration = newSubscriptionMatrixPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionMatrixPrice.invoicingCycleConfiguration conversionRate = newSubscriptionMatrixPrice.conversionRate - modelType = newSubscriptionMatrixPrice.modelType - matrixConfig = newSubscriptionMatrixPrice.matrixConfig currency = newSubscriptionMatrixPrice.currency + externalPriceId = newSubscriptionMatrixPrice.externalPriceId + fixedPriceQuantity = newSubscriptionMatrixPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionMatrixPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionMatrixPrice.invoicingCycleConfiguration + metadata = newSubscriptionMatrixPrice.metadata referenceId = newSubscriptionMatrixPrice.referenceId additionalProperties = newSubscriptionMatrixPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = apply { + this.matrixConfig = matrixConfig } + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -26540,77 +29243,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun matrixConfig(matrixConfig: MatrixConfig) = apply { - this.matrixConfig = matrixConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26636,23 +29433,23 @@ constructor( fun build(): NewSubscriptionMatrixPrice = NewSubscriptionMatrixPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(matrixConfig) { + "`matrixConfig` is required but was not set" + }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(matrixConfig) { - "`matrixConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -26744,16 +29541,13 @@ constructor( class MatrixConfig @JsonCreator private constructor( - @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("default_unit_amount") private val defaultUnitAmount: String, + @JsonProperty("dimensions") private val dimensions: List, @JsonProperty("matrix_values") private val matrixValues: List, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") fun dimensions(): List = dimensions - /** * Default per unit rate for any usage not bucketed into a specified * matrix_value @@ -26761,6 +29555,9 @@ constructor( @JsonProperty("default_unit_amount") fun defaultUnitAmount(): String = defaultUnitAmount + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") fun dimensions(): List = dimensions + /** Matrix values for specified matrix grouping keys */ @JsonProperty("matrix_values") fun matrixValues(): List = matrixValues @@ -26778,20 +29575,28 @@ constructor( class Builder { - private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null + private var dimensions: MutableList? = null private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixConfig: MatrixConfig) = apply { - dimensions = matrixConfig.dimensions.toMutableList() defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.toMutableList() matrixValues = matrixConfig.matrixValues.toMutableList() additionalProperties = matrixConfig.additionalProperties.toMutableMap() } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { this.dimensions = dimensions.toMutableList() @@ -26802,14 +29607,6 @@ constructor( dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } - /** - * Default per unit rate for any usage not bucketed into a specified - * matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { this.matrixValues = matrixValues.toMutableList() @@ -26845,13 +29642,13 @@ constructor( fun build(): MatrixConfig = MatrixConfig( + checkNotNull(defaultUnitAmount) { + "`defaultUnitAmount` is required but was not set" + }, checkNotNull(dimensions) { "`dimensions` is required but was not set" } .toImmutable(), - checkNotNull(defaultUnitAmount) { - "`defaultUnitAmount` is required but was not set" - }, checkNotNull(matrixValues) { "`matrixValues` is required but was not set" } @@ -26864,17 +29661,14 @@ constructor( class MatrixValue @JsonCreator private constructor( - @JsonProperty("unit_amount") private val unitAmount: String, @JsonProperty("dimension_values") private val dimensionValues: List, + @JsonProperty("unit_amount") private val unitAmount: String, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -26883,6 +29677,9 @@ constructor( @JsonProperty("dimension_values") fun dimensionValues(): List = dimensionValues + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -26896,24 +29693,19 @@ constructor( class Builder { - private var unitAmount: String? = null private var dimensionValues: MutableList? = null + private var unitAmount: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(matrixValue: MatrixValue) = apply { - unitAmount = matrixValue.unitAmount dimensionValues = matrixValue.dimensionValues.toMutableList() + unitAmount = matrixValue.unitAmount additionalProperties = matrixValue.additionalProperties.toMutableMap() } - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } - /** * One or two matrix keys to filter usage to this Matrix value by. For * example, ["region", "tier"] could be used to filter cloud usage by a @@ -26935,6 +29727,11 @@ constructor( } } + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26959,13 +29756,13 @@ constructor( fun build(): MatrixValue = MatrixValue( - checkNotNull(unitAmount) { - "`unitAmount` is required but was not set" - }, checkNotNull(dimensionValues) { "`dimensionValues` is required but was not set" } .toImmutable(), + checkNotNull(unitAmount) { + "`unitAmount` is required but was not set" + }, additionalProperties.toImmutable(), ) } @@ -26975,17 +29772,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixValue && unitAmount == other.unitAmount && dimensionValues == other.dimensionValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, dimensionValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -26993,17 +29790,17 @@ constructor( return true } - return /* spotless:off */ other is MatrixConfig && dimensions == other.dimensions && defaultUnitAmount == other.defaultUnitAmount && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } class ModelType @@ -27468,60 +30265,58 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionMatrixPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && matrixConfig == other.matrixConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionMatrixPrice && cadence == other.cadence && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, matrixConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionMatrixPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, matrixConfig=$matrixConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionMatrixPrice{cadence=$cadence, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_config") private val tieredConfig: TieredConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -27529,9 +30324,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -27539,6 +30331,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -27550,17 +30365,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -27569,20 +30373,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_config") fun tieredConfig(): TieredConfig = tieredConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -27604,139 +30401,233 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredConfig: TieredConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredConfig: TieredConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionTieredPrice: NewSubscriptionTieredPrice) = apply { - metadata = newSubscriptionTieredPrice.metadata - externalPriceId = newSubscriptionTieredPrice.externalPriceId + cadence = newSubscriptionTieredPrice.cadence + itemId = newSubscriptionTieredPrice.itemId + modelType = newSubscriptionTieredPrice.modelType name = newSubscriptionTieredPrice.name + tieredConfig = newSubscriptionTieredPrice.tieredConfig billableMetricId = newSubscriptionTieredPrice.billableMetricId - itemId = newSubscriptionTieredPrice.itemId billedInAdvance = newSubscriptionTieredPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey - cadence = newSubscriptionTieredPrice.cadence billingCycleConfiguration = newSubscriptionTieredPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPrice.conversionRate - modelType = newSubscriptionTieredPrice.modelType - tieredConfig = newSubscriptionTieredPrice.tieredConfig currency = newSubscriptionTieredPrice.currency + externalPriceId = newSubscriptionTieredPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPrice.metadata referenceId = newSubscriptionTieredPrice.referenceId additionalProperties = newSubscriptionTieredPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredConfig(tieredConfig: TieredConfig) = apply { + this.tieredConfig = tieredConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredConfig(tieredConfig: TieredConfig) = apply { - this.tieredConfig = tieredConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -27762,23 +30653,23 @@ constructor( fun build(): NewSubscriptionTieredPrice = NewSubscriptionTieredPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredConfig) { "`tieredConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -28000,8 +30891,8 @@ constructor( @JsonCreator private constructor( @JsonProperty("first_unit") private val firstUnit: Double, - @JsonProperty("last_unit") private val lastUnit: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("last_unit") private val lastUnit: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), @@ -28010,15 +30901,15 @@ constructor( /** Inclusive tier starting value */ @JsonProperty("first_unit") fun firstUnit(): Double = firstUnit + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** * Exclusive tier ending value. If null, this is treated as the last tier */ @JsonProperty("last_unit") fun lastUnit(): Optional = Optional.ofNullable(lastUnit) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -28033,32 +30924,48 @@ constructor( class Builder { private var firstUnit: Double? = null - private var lastUnit: Double? = null private var unitAmount: String? = null + private var lastUnit: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { firstUnit = tier.firstUnit - lastUnit = tier.lastUnit unitAmount = tier.unitAmount + lastUnit = tier.lastUnit additionalProperties = tier.additionalProperties.toMutableMap() } /** Inclusive tier starting value */ fun firstUnit(firstUnit: Double) = apply { this.firstUnit = firstUnit } + /** Amount per unit */ + fun unitAmount(unitAmount: String) = apply { + this.unitAmount = unitAmount + } + /** * Exclusive tier ending value. If null, this is treated as the last * tier */ - fun lastUnit(lastUnit: Double) = apply { this.lastUnit = lastUnit } + fun lastUnit(lastUnit: Double?) = apply { this.lastUnit = lastUnit } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = apply { - this.unitAmount = unitAmount - } + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last + * tier + */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) fun additionalProperties(additionalProperties: Map) = apply { @@ -28087,10 +30994,10 @@ constructor( checkNotNull(firstUnit) { "`firstUnit` is required but was not set" }, - lastUnit, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + lastUnit, additionalProperties.toImmutable(), ) } @@ -28100,17 +31007,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && lastUnit == other.lastUnit && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -28541,60 +31448,59 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredConfig == other.tieredConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredConfig=$tieredConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_bps_config") private val tieredBpsConfig: TieredBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_bps_config") + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -28602,9 +31508,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -28612,6 +31515,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -28623,17 +31549,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -28642,21 +31557,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_bps_config") - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -28678,21 +31585,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredBpsConfig: TieredBpsConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredBpsConfig: TieredBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -28700,118 +31607,212 @@ constructor( internal fun from( newSubscriptionTieredBpsPrice: NewSubscriptionTieredBpsPrice ) = apply { - metadata = newSubscriptionTieredBpsPrice.metadata - externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + cadence = newSubscriptionTieredBpsPrice.cadence + itemId = newSubscriptionTieredBpsPrice.itemId + modelType = newSubscriptionTieredBpsPrice.modelType name = newSubscriptionTieredBpsPrice.name + tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig billableMetricId = newSubscriptionTieredBpsPrice.billableMetricId - itemId = newSubscriptionTieredBpsPrice.itemId billedInAdvance = newSubscriptionTieredBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey - cadence = newSubscriptionTieredBpsPrice.cadence billingCycleConfiguration = newSubscriptionTieredBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredBpsPrice.conversionRate - modelType = newSubscriptionTieredBpsPrice.modelType - tieredBpsConfig = newSubscriptionTieredBpsPrice.tieredBpsConfig currency = newSubscriptionTieredBpsPrice.currency + externalPriceId = newSubscriptionTieredBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredBpsPrice.metadata referenceId = newSubscriptionTieredBpsPrice.referenceId additionalProperties = newSubscriptionTieredBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { + this.tieredBpsConfig = tieredBpsConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = apply { - this.tieredBpsConfig = tieredBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -28837,23 +31838,23 @@ constructor( fun build(): NewSubscriptionTieredBpsPrice = NewSubscriptionTieredBpsPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredBpsConfig) { "`tieredBpsConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -29080,15 +32081,18 @@ constructor( class Tier @JsonCreator private constructor( + @JsonProperty("bps") private val bps: Double, @JsonProperty("minimum_amount") private val minimumAmount: String, @JsonProperty("maximum_amount") private val maximumAmount: String?, - @JsonProperty("bps") private val bps: Double, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Per-event basis point rate */ + @JsonProperty("bps") fun bps(): Double = bps + /** Inclusive tier starting value */ @JsonProperty("minimum_amount") fun minimumAmount(): String = minimumAmount @@ -29096,9 +32100,6 @@ constructor( @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Per-event basis point rate */ - @JsonProperty("bps") fun bps(): Double = bps - /** Per unit maximum to charge */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -29116,40 +32117,48 @@ constructor( class Builder { + private var bps: Double? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var bps: Double? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { + bps = tier.bps minimumAmount = tier.minimumAmount maximumAmount = tier.maximumAmount - bps = tier.bps perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Per-event basis point rate */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Inclusive tier starting value */ fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Per-event basis point rate */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -29174,11 +32183,11 @@ constructor( fun build(): Tier = Tier( + checkNotNull(bps) { "`bps` is required but was not set" }, checkNotNull(minimumAmount) { "`minimumAmount` is required but was not set" }, maximumAmount, - checkNotNull(bps) { "`bps` is required but was not set" }, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -29189,17 +32198,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -29630,56 +32639,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredBpsConfig == other.tieredBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredBpsPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredBpsConfig=$tieredBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredBpsPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bps_config") private val bpsConfig: BpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bps_config") private val bpsConfig: BpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -29691,9 +32698,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -29701,6 +32705,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -29712,17 +32739,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -29731,20 +32747,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bps_config") fun bpsConfig(): BpsConfig = bpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -29766,59 +32775,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bpsConfig: BpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bpsConfig: BpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBpsPrice: NewSubscriptionBpsPrice) = apply { - metadata = newSubscriptionBpsPrice.metadata - externalPriceId = newSubscriptionBpsPrice.externalPriceId + bpsConfig = newSubscriptionBpsPrice.bpsConfig + cadence = newSubscriptionBpsPrice.cadence + itemId = newSubscriptionBpsPrice.itemId + modelType = newSubscriptionBpsPrice.modelType name = newSubscriptionBpsPrice.name billableMetricId = newSubscriptionBpsPrice.billableMetricId - itemId = newSubscriptionBpsPrice.itemId billedInAdvance = newSubscriptionBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBpsPrice.cadence billingCycleConfiguration = newSubscriptionBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBpsPrice.conversionRate - modelType = newSubscriptionBpsPrice.modelType - bpsConfig = newSubscriptionBpsPrice.bpsConfig currency = newSubscriptionBpsPrice.currency + externalPriceId = newSubscriptionBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBpsPrice.metadata referenceId = newSubscriptionBpsPrice.referenceId additionalProperties = newSubscriptionBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -29827,75 +32834,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bpsConfig(bpsConfig: BpsConfig) = apply { this.bpsConfig = bpsConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -29921,21 +33024,21 @@ constructor( fun build(): NewSubscriptionBpsPrice = NewSubscriptionBpsPrice( - metadata, - externalPriceId, + checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bpsConfig) { "`bpsConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -29987,10 +33090,14 @@ constructor( fun bps(bps: Double) = apply { this.bps = bps } /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -30583,56 +33690,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bpsConfig == other.bpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bpsConfig=$bpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkBpsPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_bps_config") private val bulkBpsConfig: BulkBpsConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -30644,9 +33749,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -30654,6 +33756,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -30665,17 +33790,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -30684,20 +33798,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_bps_config") fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -30719,61 +33826,61 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkBpsConfig: BulkBpsConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkBpsConfig: BulkBpsConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkBpsPrice: NewSubscriptionBulkBpsPrice) = apply { - metadata = newSubscriptionBulkBpsPrice.metadata - externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig + cadence = newSubscriptionBulkBpsPrice.cadence + itemId = newSubscriptionBulkBpsPrice.itemId + modelType = newSubscriptionBulkBpsPrice.modelType name = newSubscriptionBulkBpsPrice.name billableMetricId = newSubscriptionBulkBpsPrice.billableMetricId - itemId = newSubscriptionBulkBpsPrice.itemId billedInAdvance = newSubscriptionBulkBpsPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey - cadence = newSubscriptionBulkBpsPrice.cadence billingCycleConfiguration = newSubscriptionBulkBpsPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkBpsPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkBpsPrice.conversionRate - modelType = newSubscriptionBulkBpsPrice.modelType - bulkBpsConfig = newSubscriptionBulkBpsPrice.bulkBpsConfig currency = newSubscriptionBulkBpsPrice.currency + externalPriceId = newSubscriptionBulkBpsPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkBpsPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkBpsPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkBpsPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkBpsPrice.metadata referenceId = newSubscriptionBulkBpsPrice.referenceId additionalProperties = newSubscriptionBulkBpsPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { + this.bulkBpsConfig = bulkBpsConfig } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -30781,77 +33888,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } - - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = apply { - this.bulkBpsConfig = bulkBpsConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -30877,23 +34078,23 @@ constructor( fun build(): NewSubscriptionBulkBpsPrice = NewSubscriptionBulkBpsPrice( - metadata, - externalPriceId, + checkNotNull(bulkBpsConfig) { + "`bulkBpsConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkBpsConfig) { - "`bulkBpsConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -30985,21 +34186,21 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("bps") private val bps: Double, + @JsonProperty("maximum_amount") private val maximumAmount: String?, @JsonProperty("per_unit_maximum") private val perUnitMaximum: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Basis points to rate on */ + @JsonProperty("bps") fun bps(): Double = bps + /** Upper bound for tier */ @JsonProperty("maximum_amount") fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount) - /** Basis points to rate on */ - @JsonProperty("bps") fun bps(): Double = bps - /** The maximum amount to charge for any one event */ @JsonProperty("per_unit_maximum") fun perUnitMaximum(): Optional = Optional.ofNullable(perUnitMaximum) @@ -31017,33 +34218,41 @@ constructor( class Builder { - private var maximumAmount: String? = null private var bps: Double? = null + private var maximumAmount: String? = null private var perUnitMaximum: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumAmount = tier.maximumAmount bps = tier.bps + maximumAmount = tier.maximumAmount perUnitMaximum = tier.perUnitMaximum additionalProperties = tier.additionalProperties.toMutableMap() } + /** Basis points to rate on */ + fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = apply { + fun maximumAmount(maximumAmount: String?) = apply { this.maximumAmount = maximumAmount } - /** Basis points to rate on */ - fun bps(bps: Double) = apply { this.bps = bps } + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = apply { + fun perUnitMaximum(perUnitMaximum: String?) = apply { this.perUnitMaximum = perUnitMaximum } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -31068,8 +34277,8 @@ constructor( fun build(): Tier = Tier( - maximumAmount, checkNotNull(bps) { "`bps` is required but was not set" }, + maximumAmount, perUnitMaximum, additionalProperties.toImmutable(), ) @@ -31080,17 +34289,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumAmount == other.maximumAmount && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -31655,56 +34864,54 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkBpsConfig == other.bulkBpsConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkBpsConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkBpsPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkBpsConfig=$bulkBpsConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_config") private val bulkConfig: BulkConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -31716,9 +34923,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -31726,6 +34930,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -31737,17 +34964,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -31756,20 +34972,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_config") fun bulkConfig(): BulkConfig = bulkConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -31791,59 +35000,57 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkConfig: BulkConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkConfig: BulkConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(newSubscriptionBulkPrice: NewSubscriptionBulkPrice) = apply { - metadata = newSubscriptionBulkPrice.metadata - externalPriceId = newSubscriptionBulkPrice.externalPriceId + bulkConfig = newSubscriptionBulkPrice.bulkConfig + cadence = newSubscriptionBulkPrice.cadence + itemId = newSubscriptionBulkPrice.itemId + modelType = newSubscriptionBulkPrice.modelType name = newSubscriptionBulkPrice.name billableMetricId = newSubscriptionBulkPrice.billableMetricId - itemId = newSubscriptionBulkPrice.itemId billedInAdvance = newSubscriptionBulkPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey - cadence = newSubscriptionBulkPrice.cadence billingCycleConfiguration = newSubscriptionBulkPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionBulkPrice.invoicingCycleConfiguration conversionRate = newSubscriptionBulkPrice.conversionRate - modelType = newSubscriptionBulkPrice.modelType - bulkConfig = newSubscriptionBulkPrice.bulkConfig currency = newSubscriptionBulkPrice.currency + externalPriceId = newSubscriptionBulkPrice.externalPriceId + fixedPriceQuantity = newSubscriptionBulkPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionBulkPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionBulkPrice.invoicingCycleConfiguration + metadata = newSubscriptionBulkPrice.metadata referenceId = newSubscriptionBulkPrice.referenceId additionalProperties = newSubscriptionBulkPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -31852,75 +35059,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bulkConfig(bulkConfig: BulkConfig) = apply { this.bulkConfig = bulkConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -31946,21 +35249,21 @@ constructor( fun build(): NewSubscriptionBulkPrice = NewSubscriptionBulkPrice( - metadata, - externalPriceId, + checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkConfig) { "`bulkConfig` is required but was not set" }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -32043,20 +35346,20 @@ constructor( class Tier @JsonCreator private constructor( - @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonProperty("unit_amount") private val unitAmount: String, + @JsonProperty("maximum_units") private val maximumUnits: Double?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** Amount per unit */ + @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount + /** Upper bound for this tier */ @JsonProperty("maximum_units") fun maximumUnits(): Optional = Optional.ofNullable(maximumUnits) - /** Amount per unit */ - @JsonProperty("unit_amount") fun unitAmount(): String = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -32070,28 +35373,39 @@ constructor( class Builder { - private var maximumUnits: Double? = null private var unitAmount: String? = null + private var maximumUnits: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - maximumUnits = tier.maximumUnits unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits additionalProperties = tier.additionalProperties.toMutableMap() } - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = apply { - this.maximumUnits = maximumUnits - } - /** Amount per unit */ fun unitAmount(unitAmount: String) = apply { this.unitAmount = unitAmount } + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double?) = apply { + this.maximumUnits = maximumUnits + } + + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(maximumUnits as Double?) + + /** Upper bound for this tier */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -32116,10 +35430,10 @@ constructor( fun build(): Tier = Tier( - maximumUnits, checkNotNull(unitAmount) { "`unitAmount` is required but was not set" }, + maximumUnits, additionalProperties.toImmutable(), ) } @@ -32129,17 +35443,17 @@ constructor( return true } - return /* spotless:off */ other is Tier && maximumUnits == other.maximumUnits && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(maximumUnits, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -32704,61 +36018,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkConfig == other.bulkConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkConfig=$bulkConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionThresholdTotalAmountPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("threshold_total_amount_config") + private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("threshold_total_amount_config") - private val thresholdTotalAmountConfig: ThresholdTotalAmountConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("threshold_total_amount_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -32766,9 +36080,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -32776,6 +36087,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -32787,17 +36121,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -32806,22 +36129,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("threshold_total_amount_config") - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -32843,21 +36157,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var thresholdTotalAmountConfig: ThresholdTotalAmountConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -32866,122 +36180,216 @@ constructor( newSubscriptionThresholdTotalAmountPrice: NewSubscriptionThresholdTotalAmountPrice ) = apply { - metadata = newSubscriptionThresholdTotalAmountPrice.metadata - externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId + cadence = newSubscriptionThresholdTotalAmountPrice.cadence + itemId = newSubscriptionThresholdTotalAmountPrice.itemId + modelType = newSubscriptionThresholdTotalAmountPrice.modelType name = newSubscriptionThresholdTotalAmountPrice.name + thresholdTotalAmountConfig = + newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig billableMetricId = newSubscriptionThresholdTotalAmountPrice.billableMetricId - itemId = newSubscriptionThresholdTotalAmountPrice.itemId billedInAdvance = newSubscriptionThresholdTotalAmountPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration + conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate + currency = newSubscriptionThresholdTotalAmountPrice.currency + externalPriceId = newSubscriptionThresholdTotalAmountPrice.externalPriceId fixedPriceQuantity = newSubscriptionThresholdTotalAmountPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionThresholdTotalAmountPrice.invoiceGroupingKey - cadence = newSubscriptionThresholdTotalAmountPrice.cadence - billingCycleConfiguration = - newSubscriptionThresholdTotalAmountPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionThresholdTotalAmountPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionThresholdTotalAmountPrice.conversionRate - modelType = newSubscriptionThresholdTotalAmountPrice.modelType - thresholdTotalAmountConfig = - newSubscriptionThresholdTotalAmountPrice.thresholdTotalAmountConfig - currency = newSubscriptionThresholdTotalAmountPrice.currency + metadata = newSubscriptionThresholdTotalAmountPrice.metadata referenceId = newSubscriptionThresholdTotalAmountPrice.referenceId additionalProperties = newSubscriptionThresholdTotalAmountPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: ThresholdTotalAmountConfig + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: ThresholdTotalAmountConfig - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -33007,23 +36415,23 @@ constructor( fun build(): NewSubscriptionThresholdTotalAmountPrice = NewSubscriptionThresholdTotalAmountPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(thresholdTotalAmountConfig) { "`thresholdTotalAmountConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -33648,61 +37056,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionThresholdTotalAmountPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, thresholdTotalAmountConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionThresholdTotalAmountPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionThresholdTotalAmountPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredPackagePrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_package_config") + private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_package_config") - private val tieredPackageConfig: TieredPackageConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_package_config") + fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -33710,9 +37117,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -33720,6 +37124,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -33731,17 +37158,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -33750,21 +37166,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_package_config") - fun tieredPackageConfig(): TieredPackageConfig = tieredPackageConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -33786,21 +37194,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredPackageConfig: TieredPackageConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredPackageConfig: TieredPackageConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -33808,118 +37216,212 @@ constructor( internal fun from( newSubscriptionTieredPackagePrice: NewSubscriptionTieredPackagePrice ) = apply { - metadata = newSubscriptionTieredPackagePrice.metadata - externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + cadence = newSubscriptionTieredPackagePrice.cadence + itemId = newSubscriptionTieredPackagePrice.itemId + modelType = newSubscriptionTieredPackagePrice.modelType name = newSubscriptionTieredPackagePrice.name + tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig billableMetricId = newSubscriptionTieredPackagePrice.billableMetricId - itemId = newSubscriptionTieredPackagePrice.itemId billedInAdvance = newSubscriptionTieredPackagePrice.billedInAdvance - fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey - cadence = newSubscriptionTieredPackagePrice.cadence billingCycleConfiguration = newSubscriptionTieredPackagePrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionTieredPackagePrice.invoicingCycleConfiguration conversionRate = newSubscriptionTieredPackagePrice.conversionRate - modelType = newSubscriptionTieredPackagePrice.modelType - tieredPackageConfig = newSubscriptionTieredPackagePrice.tieredPackageConfig currency = newSubscriptionTieredPackagePrice.currency + externalPriceId = newSubscriptionTieredPackagePrice.externalPriceId + fixedPriceQuantity = newSubscriptionTieredPackagePrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionTieredPackagePrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionTieredPackagePrice.invoicingCycleConfiguration + metadata = newSubscriptionTieredPackagePrice.metadata referenceId = newSubscriptionTieredPackagePrice.referenceId additionalProperties = newSubscriptionTieredPackagePrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { + this.tieredPackageConfig = tieredPackageConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = apply { - this.tieredPackageConfig = tieredPackageConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -33945,23 +37447,23 @@ constructor( fun build(): NewSubscriptionTieredPackagePrice = NewSubscriptionTieredPackagePrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredPackageConfig) { "`tieredPackageConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -34585,61 +38087,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredPackageConfig == other.tieredPackageConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredPackageConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredPackageConfig=$tieredPackageConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTieredWithMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_minimum_config") + private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_minimum_config") - private val tieredWithMinimumConfig: TieredWithMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_minimum_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -34647,9 +38148,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -34657,6 +38155,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -34668,17 +38189,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -34687,21 +38197,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_minimum_config") - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = tieredWithMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -34723,21 +38225,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithMinimumConfig: TieredWithMinimumConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -34745,123 +38247,217 @@ constructor( internal fun from( newSubscriptionTieredWithMinimumPrice: NewSubscriptionTieredWithMinimumPrice ) = apply { - metadata = newSubscriptionTieredWithMinimumPrice.metadata - externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId + cadence = newSubscriptionTieredWithMinimumPrice.cadence + itemId = newSubscriptionTieredWithMinimumPrice.itemId + modelType = newSubscriptionTieredWithMinimumPrice.modelType name = newSubscriptionTieredWithMinimumPrice.name + tieredWithMinimumConfig = + newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig billableMetricId = newSubscriptionTieredWithMinimumPrice.billableMetricId - itemId = newSubscriptionTieredWithMinimumPrice.itemId billedInAdvance = newSubscriptionTieredWithMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration + conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate + currency = newSubscriptionTieredWithMinimumPrice.currency + externalPriceId = newSubscriptionTieredWithMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionTieredWithMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTieredWithMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionTieredWithMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionTieredWithMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTieredWithMinimumPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTieredWithMinimumPrice.conversionRate - modelType = newSubscriptionTieredWithMinimumPrice.modelType - tieredWithMinimumConfig = - newSubscriptionTieredWithMinimumPrice.tieredWithMinimumConfig - currency = newSubscriptionTieredWithMinimumPrice.currency + metadata = newSubscriptionTieredWithMinimumPrice.metadata referenceId = newSubscriptionTieredWithMinimumPrice.referenceId additionalProperties = newSubscriptionTieredWithMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + apply { + this.tieredWithMinimumConfig = tieredWithMinimumConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - apply { - this.tieredWithMinimumConfig = tieredWithMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -34887,23 +38483,23 @@ constructor( fun build(): NewSubscriptionTieredWithMinimumPrice = NewSubscriptionTieredWithMinimumPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithMinimumConfig) { "`tieredWithMinimumConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -35528,61 +39124,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTieredWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTieredWithMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithMinimumConfig=$tieredWithMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTieredWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithPercentPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_percent_config") + private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_percent_config") - private val unitWithPercentConfig: UnitWithPercentConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_percent_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -35590,9 +39185,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -35600,6 +39192,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -35611,17 +39226,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -35630,21 +39234,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_percent_config") - fun unitWithPercentConfig(): UnitWithPercentConfig = unitWithPercentConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -35666,21 +39262,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithPercentConfig: UnitWithPercentConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithPercentConfig: UnitWithPercentConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -35688,120 +39284,214 @@ constructor( internal fun from( newSubscriptionUnitWithPercentPrice: NewSubscriptionUnitWithPercentPrice ) = apply { - metadata = newSubscriptionUnitWithPercentPrice.metadata - externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + cadence = newSubscriptionUnitWithPercentPrice.cadence + itemId = newSubscriptionUnitWithPercentPrice.itemId + modelType = newSubscriptionUnitWithPercentPrice.modelType name = newSubscriptionUnitWithPercentPrice.name + unitWithPercentConfig = + newSubscriptionUnitWithPercentPrice.unitWithPercentConfig billableMetricId = newSubscriptionUnitWithPercentPrice.billableMetricId - itemId = newSubscriptionUnitWithPercentPrice.itemId billedInAdvance = newSubscriptionUnitWithPercentPrice.billedInAdvance - fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity - invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithPercentPrice.cadence billingCycleConfiguration = newSubscriptionUnitWithPercentPrice.billingCycleConfiguration - invoicingCycleConfiguration = - newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration conversionRate = newSubscriptionUnitWithPercentPrice.conversionRate - modelType = newSubscriptionUnitWithPercentPrice.modelType - unitWithPercentConfig = - newSubscriptionUnitWithPercentPrice.unitWithPercentConfig currency = newSubscriptionUnitWithPercentPrice.currency + externalPriceId = newSubscriptionUnitWithPercentPrice.externalPriceId + fixedPriceQuantity = newSubscriptionUnitWithPercentPrice.fixedPriceQuantity + invoiceGroupingKey = newSubscriptionUnitWithPercentPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newSubscriptionUnitWithPercentPrice.invoicingCycleConfiguration + metadata = newSubscriptionUnitWithPercentPrice.metadata referenceId = newSubscriptionUnitWithPercentPrice.referenceId additionalProperties = newSubscriptionUnitWithPercentPrice.additionalProperties.toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = + apply { + this.unitWithPercentConfig = unitWithPercentConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = - apply { - this.unitWithPercentConfig = unitWithPercentConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -35827,23 +39517,23 @@ constructor( fun build(): NewSubscriptionUnitWithPercentPrice = NewSubscriptionUnitWithPercentPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithPercentConfig) { "`unitWithPercentConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -36467,61 +40157,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithPercentConfig == other.unitWithPercentConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithPercentPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithPercentConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithPercentPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithPercentConfig=$unitWithPercentConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithPercentPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionPackageWithAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("package_with_allocation_config") + private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("package_with_allocation_config") - private val packageWithAllocationConfig: PackageWithAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("package_with_allocation_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -36529,9 +40219,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -36539,6 +40226,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -36550,17 +40260,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -36569,22 +40268,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("package_with_allocation_config") - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -36606,21 +40296,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var packageWithAllocationConfig: PackageWithAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -36629,123 +40319,217 @@ constructor( newSubscriptionPackageWithAllocationPrice: NewSubscriptionPackageWithAllocationPrice ) = apply { - metadata = newSubscriptionPackageWithAllocationPrice.metadata - externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId + cadence = newSubscriptionPackageWithAllocationPrice.cadence + itemId = newSubscriptionPackageWithAllocationPrice.itemId + modelType = newSubscriptionPackageWithAllocationPrice.modelType name = newSubscriptionPackageWithAllocationPrice.name + packageWithAllocationConfig = + newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig billableMetricId = newSubscriptionPackageWithAllocationPrice.billableMetricId - itemId = newSubscriptionPackageWithAllocationPrice.itemId billedInAdvance = newSubscriptionPackageWithAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate + currency = newSubscriptionPackageWithAllocationPrice.currency + externalPriceId = newSubscriptionPackageWithAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionPackageWithAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionPackageWithAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionPackageWithAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionPackageWithAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionPackageWithAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionPackageWithAllocationPrice.conversionRate - modelType = newSubscriptionPackageWithAllocationPrice.modelType - packageWithAllocationConfig = - newSubscriptionPackageWithAllocationPrice.packageWithAllocationConfig - currency = newSubscriptionPackageWithAllocationPrice.currency + metadata = newSubscriptionPackageWithAllocationPrice.metadata referenceId = newSubscriptionPackageWithAllocationPrice.referenceId additionalProperties = newSubscriptionPackageWithAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -36771,23 +40555,23 @@ constructor( fun build(): NewSubscriptionPackageWithAllocationPrice = NewSubscriptionPackageWithAllocationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(packageWithAllocationConfig) { "`packageWithAllocationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -37413,61 +41197,61 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && packageWithAllocationConfig == other.packageWithAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionPackageWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, packageWithAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionPackageWithAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, packageWithAllocationConfig=$packageWithAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionPackageWithAllocationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionTierWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("tiered_with_proration_config") + private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("tiered_with_proration_config") - private val tieredWithProrationConfig: TieredWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("tiered_with_proration_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -37475,9 +41259,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -37485,6 +41266,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -37496,17 +41300,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -37515,22 +41308,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("tiered_with_proration_config") - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -37552,21 +41336,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var tieredWithProrationConfig: TieredWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -37574,122 +41358,216 @@ constructor( internal fun from( newSubscriptionTierWithProrationPrice: NewSubscriptionTierWithProrationPrice ) = apply { - metadata = newSubscriptionTierWithProrationPrice.metadata - externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId + cadence = newSubscriptionTierWithProrationPrice.cadence + itemId = newSubscriptionTierWithProrationPrice.itemId + modelType = newSubscriptionTierWithProrationPrice.modelType name = newSubscriptionTierWithProrationPrice.name + tieredWithProrationConfig = + newSubscriptionTierWithProrationPrice.tieredWithProrationConfig billableMetricId = newSubscriptionTierWithProrationPrice.billableMetricId - itemId = newSubscriptionTierWithProrationPrice.itemId billedInAdvance = newSubscriptionTierWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionTierWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionTierWithProrationPrice.conversionRate + currency = newSubscriptionTierWithProrationPrice.currency + externalPriceId = newSubscriptionTierWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionTierWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionTierWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionTierWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionTierWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionTierWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionTierWithProrationPrice.conversionRate - modelType = newSubscriptionTierWithProrationPrice.modelType - tieredWithProrationConfig = - newSubscriptionTierWithProrationPrice.tieredWithProrationConfig - currency = newSubscriptionTierWithProrationPrice.currency + metadata = newSubscriptionTierWithProrationPrice.metadata referenceId = newSubscriptionTierWithProrationPrice.referenceId additionalProperties = newSubscriptionTierWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun tieredWithProrationConfig( + tieredWithProrationConfig: TieredWithProrationConfig + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun tieredWithProrationConfig( - tieredWithProrationConfig: TieredWithProrationConfig - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -37715,23 +41593,23 @@ constructor( fun build(): NewSubscriptionTierWithProrationPrice = NewSubscriptionTierWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(tieredWithProrationConfig) { "`tieredWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -38356,61 +42234,60 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && tieredWithProrationConfig == other.tieredWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionTierWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, tieredWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionTierWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, tieredWithProrationConfig=$tieredWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionTierWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionUnitWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, + @JsonProperty("unit_with_proration_config") + private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("unit_with_proration_config") - private val unitWithProrationConfig: UnitWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name + @JsonProperty("unit_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. @@ -38418,9 +42295,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -38428,6 +42302,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -38439,17 +42336,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -38458,21 +42344,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("unit_with_proration_config") - fun unitWithProrationConfig(): UnitWithProrationConfig = unitWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -38494,21 +42372,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null + private var unitWithProrationConfig: UnitWithProrationConfig? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var unitWithProrationConfig: UnitWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -38516,123 +42394,217 @@ constructor( internal fun from( newSubscriptionUnitWithProrationPrice: NewSubscriptionUnitWithProrationPrice ) = apply { - metadata = newSubscriptionUnitWithProrationPrice.metadata - externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId + cadence = newSubscriptionUnitWithProrationPrice.cadence + itemId = newSubscriptionUnitWithProrationPrice.itemId + modelType = newSubscriptionUnitWithProrationPrice.modelType name = newSubscriptionUnitWithProrationPrice.name + unitWithProrationConfig = + newSubscriptionUnitWithProrationPrice.unitWithProrationConfig billableMetricId = newSubscriptionUnitWithProrationPrice.billableMetricId - itemId = newSubscriptionUnitWithProrationPrice.itemId billedInAdvance = newSubscriptionUnitWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionUnitWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate + currency = newSubscriptionUnitWithProrationPrice.currency + externalPriceId = newSubscriptionUnitWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionUnitWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionUnitWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionUnitWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionUnitWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionUnitWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionUnitWithProrationPrice.conversionRate - modelType = newSubscriptionUnitWithProrationPrice.modelType - unitWithProrationConfig = - newSubscriptionUnitWithProrationPrice.unitWithProrationConfig - currency = newSubscriptionUnitWithProrationPrice.currency + metadata = newSubscriptionUnitWithProrationPrice.metadata referenceId = newSubscriptionUnitWithProrationPrice.referenceId additionalProperties = newSubscriptionUnitWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + apply { + this.unitWithProrationConfig = unitWithProrationConfig + } + /** * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - apply { - this.unitWithProrationConfig = unitWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -38658,23 +42630,23 @@ constructor( fun build(): NewSubscriptionUnitWithProrationPrice = NewSubscriptionUnitWithProrationPrice( - metadata, - externalPriceId, - checkNotNull(name) { "`name` is required but was not set" }, - billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, checkNotNull(cadence) { "`cadence` is required but was not set" }, - billingCycleConfiguration, - invoicingCycleConfiguration, - conversionRate, + checkNotNull(itemId) { "`itemId` is required but was not set" }, checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(unitWithProrationConfig) { "`unitWithProrationConfig` is required but was not set" }, + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -39299,57 +43271,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && unitWithProrationConfig == other.unitWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionUnitWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, unitWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionUnitWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, unitWithProrationConfig=$unitWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionUnitWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedAllocationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_allocation_config") + private val groupedAllocationConfig: GroupedAllocationConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_allocation_config") - private val groupedAllocationConfig: GroupedAllocationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_allocation_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -39361,9 +43332,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -39371,6 +43339,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -39382,17 +43373,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -39401,21 +43381,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_allocation_config") - fun groupedAllocationConfig(): GroupedAllocationConfig = groupedAllocationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -39437,21 +43409,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedAllocationConfig: GroupedAllocationConfig? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedAllocationConfig: GroupedAllocationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -39459,43 +43431,44 @@ constructor( internal fun from( newSubscriptionGroupedAllocationPrice: NewSubscriptionGroupedAllocationPrice ) = apply { - metadata = newSubscriptionGroupedAllocationPrice.metadata - externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId + cadence = newSubscriptionGroupedAllocationPrice.cadence + groupedAllocationConfig = + newSubscriptionGroupedAllocationPrice.groupedAllocationConfig + itemId = newSubscriptionGroupedAllocationPrice.itemId + modelType = newSubscriptionGroupedAllocationPrice.modelType name = newSubscriptionGroupedAllocationPrice.name billableMetricId = newSubscriptionGroupedAllocationPrice.billableMetricId - itemId = newSubscriptionGroupedAllocationPrice.itemId billedInAdvance = newSubscriptionGroupedAllocationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedAllocationPrice.billingCycleConfiguration + conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate + currency = newSubscriptionGroupedAllocationPrice.currency + externalPriceId = newSubscriptionGroupedAllocationPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedAllocationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedAllocationPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedAllocationPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedAllocationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedAllocationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionGroupedAllocationPrice.conversionRate - modelType = newSubscriptionGroupedAllocationPrice.modelType - groupedAllocationConfig = - newSubscriptionGroupedAllocationPrice.groupedAllocationConfig - currency = newSubscriptionGroupedAllocationPrice.currency + metadata = newSubscriptionGroupedAllocationPrice.metadata referenceId = newSubscriptionGroupedAllocationPrice.referenceId additionalProperties = newSubscriptionGroupedAllocationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + apply { + this.groupedAllocationConfig = groupedAllocationConfig + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -39504,78 +43477,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - apply { - this.groupedAllocationConfig = groupedAllocationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -39601,23 +43667,23 @@ constructor( fun build(): NewSubscriptionGroupedAllocationPrice = NewSubscriptionGroupedAllocationPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedAllocationConfig) { + "`groupedAllocationConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedAllocationConfig) { - "`groupedAllocationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -40242,57 +44308,57 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedAllocationConfig == other.groupedAllocationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedAllocationPrice && cadence == other.cadence && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedAllocationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedAllocationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedAllocationConfig=$groupedAllocationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedAllocationPrice{cadence=$cadence, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionGroupedWithProratedMinimumPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("grouped_with_prorated_minimum_config") + private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("grouped_with_prorated_minimum_config") - private val groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + @JsonProperty("grouped_with_prorated_minimum_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -40304,9 +44370,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -40314,6 +44377,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -40325,17 +44411,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -40344,22 +44419,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("grouped_with_prorated_minimum_config") - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -40381,23 +44447,23 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var cadence: Cadence? = null + private var groupedWithProratedMinimumConfig: + GroupedWithProratedMinimumConfig? = + null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var groupedWithProratedMinimumConfig: - GroupedWithProratedMinimumConfig? = - null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -40406,50 +44472,52 @@ constructor( newSubscriptionGroupedWithProratedMinimumPrice: NewSubscriptionGroupedWithProratedMinimumPrice ) = apply { - metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata - externalPriceId = - newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId + cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence + groupedWithProratedMinimumConfig = + newSubscriptionGroupedWithProratedMinimumPrice + .groupedWithProratedMinimumConfig + itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId + modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType name = newSubscriptionGroupedWithProratedMinimumPrice.name billableMetricId = newSubscriptionGroupedWithProratedMinimumPrice.billableMetricId - itemId = newSubscriptionGroupedWithProratedMinimumPrice.itemId billedInAdvance = newSubscriptionGroupedWithProratedMinimumPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration + conversionRate = + newSubscriptionGroupedWithProratedMinimumPrice.conversionRate + currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + externalPriceId = + newSubscriptionGroupedWithProratedMinimumPrice.externalPriceId fixedPriceQuantity = newSubscriptionGroupedWithProratedMinimumPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionGroupedWithProratedMinimumPrice.invoiceGroupingKey - cadence = newSubscriptionGroupedWithProratedMinimumPrice.cadence - billingCycleConfiguration = - newSubscriptionGroupedWithProratedMinimumPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionGroupedWithProratedMinimumPrice .invoicingCycleConfiguration - conversionRate = - newSubscriptionGroupedWithProratedMinimumPrice.conversionRate - modelType = newSubscriptionGroupedWithProratedMinimumPrice.modelType - groupedWithProratedMinimumConfig = - newSubscriptionGroupedWithProratedMinimumPrice - .groupedWithProratedMinimumConfig - currency = newSubscriptionGroupedWithProratedMinimumPrice.currency + metadata = newSubscriptionGroupedWithProratedMinimumPrice.metadata referenceId = newSubscriptionGroupedWithProratedMinimumPrice.referenceId additionalProperties = newSubscriptionGroupedWithProratedMinimumPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -40457,79 +44525,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { - this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -40555,23 +44715,23 @@ constructor( fun build(): NewSubscriptionGroupedWithProratedMinimumPrice = NewSubscriptionGroupedWithProratedMinimumPrice( - metadata, - externalPriceId, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(groupedWithProratedMinimumConfig) { + "`groupedWithProratedMinimumConfig` is required but was not set" + }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(groupedWithProratedMinimumConfig) { - "`groupedWithProratedMinimumConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -41198,57 +45358,56 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionGroupedWithProratedMinimumPrice && cadence == other.cadence && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedWithProratedMinimumConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionGroupedWithProratedMinimumPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionGroupedWithProratedMinimumPrice{cadence=$cadence, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } @NoAutoDetect class NewSubscriptionBulkWithProrationPrice @JsonCreator private constructor( - @JsonProperty("metadata") private val metadata: Metadata?, - @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("bulk_with_proration_config") + private val bulkWithProrationConfig: BulkWithProrationConfig, + @JsonProperty("cadence") private val cadence: Cadence, + @JsonProperty("item_id") private val itemId: String, + @JsonProperty("model_type") private val modelType: ModelType, @JsonProperty("name") private val name: String, @JsonProperty("billable_metric_id") private val billableMetricId: String?, - @JsonProperty("item_id") private val itemId: String, @JsonProperty("billed_in_advance") private val billedInAdvance: Boolean?, - @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, - @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, - @JsonProperty("cadence") private val cadence: Cadence, @JsonProperty("billing_cycle_configuration") private val billingCycleConfiguration: BillingCycleConfiguration?, - @JsonProperty("invoicing_cycle_configuration") - private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, @JsonProperty("conversion_rate") private val conversionRate: Double?, - @JsonProperty("model_type") private val modelType: ModelType, - @JsonProperty("bulk_with_proration_config") - private val bulkWithProrationConfig: BulkWithProrationConfig, @JsonProperty("currency") private val currency: String?, + @JsonProperty("external_price_id") private val externalPriceId: String?, + @JsonProperty("fixed_price_quantity") private val fixedPriceQuantity: Double?, + @JsonProperty("invoice_grouping_key") private val invoiceGroupingKey: String?, + @JsonProperty("invoicing_cycle_configuration") + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + @JsonProperty("metadata") private val metadata: Metadata?, @JsonProperty("reference_id") private val referenceId: String?, @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * User-specified key/value pairs for the resource. 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") - fun metadata(): Optional = Optional.ofNullable(metadata) + @JsonProperty("bulk_with_proration_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** An alias for the price. */ - @JsonProperty("external_price_id") - fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence = cadence + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String = itemId + + @JsonProperty("model_type") fun modelType(): ModelType = modelType /** The name of the price. */ @JsonProperty("name") fun name(): String = name @@ -41260,9 +45419,6 @@ constructor( @JsonProperty("billable_metric_id") fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") fun itemId(): String = itemId - /** * If the Price represents a fixed cost, the price will be billed in-advance if this * is true, and in-arrears if this is false. @@ -41270,6 +45426,29 @@ constructor( @JsonProperty("billed_in_advance") fun billedInAdvance(): Optional = Optional.ofNullable(billedInAdvance) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): Optional = + Optional.ofNullable(billingCycleConfiguration) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(): Optional = Optional.ofNullable(conversionRate) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(): Optional = Optional.ofNullable(externalPriceId) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. @@ -41281,17 +45460,6 @@ constructor( @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): Optional = Optional.ofNullable(invoiceGroupingKey) - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") fun cadence(): Cadence = cadence - - /** - * For custom cadence: specifies the duration of the billing period in days or - * months. - */ - @JsonProperty("billing_cycle_configuration") - fun billingCycleConfiguration(): Optional = - Optional.ofNullable(billingCycleConfiguration) - /** * Within each billing cycle, specifies the cadence at which invoices are produced. * If unspecified, a single invoice is produced per billing cycle. @@ -41300,21 +45468,13 @@ constructor( fun invoicingCycleConfiguration(): Optional = Optional.ofNullable(invoicingCycleConfiguration) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - fun conversionRate(): Optional = Optional.ofNullable(conversionRate) - - @JsonProperty("model_type") fun modelType(): ModelType = modelType - - @JsonProperty("bulk_with_proration_config") - fun bulkWithProrationConfig(): BulkWithProrationConfig = bulkWithProrationConfig - /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * User-specified key/value pairs for the resource. 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("currency") - fun currency(): Optional = Optional.ofNullable(currency) + @JsonProperty("metadata") + fun metadata(): Optional = Optional.ofNullable(metadata) /** * A transient ID that can be used to reference this price when adding adjustments @@ -41336,21 +45496,21 @@ constructor( class Builder { - private var metadata: Metadata? = null - private var externalPriceId: String? = null + private var bulkWithProrationConfig: BulkWithProrationConfig? = null + private var cadence: Cadence? = null + private var itemId: String? = null + private var modelType: ModelType? = null private var name: String? = null private var billableMetricId: String? = null - private var itemId: String? = null private var billedInAdvance: Boolean? = null - private var fixedPriceQuantity: Double? = null - private var invoiceGroupingKey: String? = null - private var cadence: Cadence? = null private var billingCycleConfiguration: BillingCycleConfiguration? = null - private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null private var conversionRate: Double? = null - private var modelType: ModelType? = null - private var bulkWithProrationConfig: BulkWithProrationConfig? = null private var currency: String? = null + private var externalPriceId: String? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var metadata: Metadata? = null private var referenceId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -41358,43 +45518,44 @@ constructor( internal fun from( newSubscriptionBulkWithProrationPrice: NewSubscriptionBulkWithProrationPrice ) = apply { - metadata = newSubscriptionBulkWithProrationPrice.metadata - externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId + bulkWithProrationConfig = + newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig + cadence = newSubscriptionBulkWithProrationPrice.cadence + itemId = newSubscriptionBulkWithProrationPrice.itemId + modelType = newSubscriptionBulkWithProrationPrice.modelType name = newSubscriptionBulkWithProrationPrice.name billableMetricId = newSubscriptionBulkWithProrationPrice.billableMetricId - itemId = newSubscriptionBulkWithProrationPrice.itemId billedInAdvance = newSubscriptionBulkWithProrationPrice.billedInAdvance + billingCycleConfiguration = + newSubscriptionBulkWithProrationPrice.billingCycleConfiguration + conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate + currency = newSubscriptionBulkWithProrationPrice.currency + externalPriceId = newSubscriptionBulkWithProrationPrice.externalPriceId fixedPriceQuantity = newSubscriptionBulkWithProrationPrice.fixedPriceQuantity invoiceGroupingKey = newSubscriptionBulkWithProrationPrice.invoiceGroupingKey - cadence = newSubscriptionBulkWithProrationPrice.cadence - billingCycleConfiguration = - newSubscriptionBulkWithProrationPrice.billingCycleConfiguration invoicingCycleConfiguration = newSubscriptionBulkWithProrationPrice.invoicingCycleConfiguration - conversionRate = newSubscriptionBulkWithProrationPrice.conversionRate - modelType = newSubscriptionBulkWithProrationPrice.modelType - bulkWithProrationConfig = - newSubscriptionBulkWithProrationPrice.bulkWithProrationConfig - currency = newSubscriptionBulkWithProrationPrice.currency + metadata = newSubscriptionBulkWithProrationPrice.metadata referenceId = newSubscriptionBulkWithProrationPrice.referenceId additionalProperties = newSubscriptionBulkWithProrationPrice.additionalProperties .toMutableMap() } - /** - * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + apply { + this.bulkWithProrationConfig = bulkWithProrationConfig + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String) = apply { - this.externalPriceId = externalPriceId - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } /** The name of the price. */ fun name(name: String) = apply { this.name = name } @@ -41403,78 +45564,171 @@ constructor( * The id of the billable metric for the price. Only needed if the price is * usage-based. */ - fun billableMetricId(billableMetricId: String) = apply { + fun billableMetricId(billableMetricId: String?) = apply { this.billableMetricId = billableMetricId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** * If the Price represents a fixed cost, the price will be billed in-advance if * this is true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = apply { + fun billedInAdvance(billedInAdvance: Boolean?) = apply { this.billedInAdvance = billedInAdvance } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double?) = apply { + this.conversionRate = conversionRate + } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String?) = apply { this.currency = currency } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = apply { + this.externalPriceId = externalPriceId + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + /** * If the Price represents a fixed cost, this represents the quantity of units * applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = apply { this.fixedPriceQuantity = fixedPriceQuantity } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + fun invoiceGroupingKey(invoiceGroupingKey: String?) = apply { this.invoiceGroupingKey = invoiceGroupingKey } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) /** - * For custom cadence: specifies the duration of the billing period in days or - * months. + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: BillingCycleConfiguration - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } /** * Within each billing cycle, specifies the cadence at which invoices are * produced. If unspecified, a single invoice is produced per billing cycle. */ fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) /** - * The per unit conversion rate of the price currency to the invoicing currency. + * User-specified key/value pairs for the resource. 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 conversionRate(conversionRate: Double) = apply { - this.conversionRate = conversionRate - } - - fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - apply { - this.bulkWithProrationConfig = bulkWithProrationConfig - } + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) /** - * An ISO 4217 currency string, or custom pricing unit identifier, in which this - * price is billed. + * A transient ID that can be used to reference this price when adding + * adjustments in the same API call. */ - fun currency(currency: String) = apply { this.currency = currency } + fun referenceId(referenceId: String?) = apply { this.referenceId = referenceId } /** * A transient ID that can be used to reference this price when adding * adjustments in the same API call. */ - fun referenceId(referenceId: String) = apply { this.referenceId = referenceId } + fun referenceId(referenceId: Optional) = + referenceId(referenceId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -41500,23 +45754,23 @@ constructor( fun build(): NewSubscriptionBulkWithProrationPrice = NewSubscriptionBulkWithProrationPrice( - metadata, - externalPriceId, + checkNotNull(bulkWithProrationConfig) { + "`bulkWithProrationConfig` is required but was not set" + }, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + checkNotNull(modelType) { "`modelType` is required but was not set" }, checkNotNull(name) { "`name` is required but was not set" }, billableMetricId, - checkNotNull(itemId) { "`itemId` is required but was not set" }, billedInAdvance, - fixedPriceQuantity, - invoiceGroupingKey, - checkNotNull(cadence) { "`cadence` is required but was not set" }, billingCycleConfiguration, - invoicingCycleConfiguration, conversionRate, - checkNotNull(modelType) { "`modelType` is required but was not set" }, - checkNotNull(bulkWithProrationConfig) { - "`bulkWithProrationConfig` is required but was not set" - }, currency, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, referenceId, additionalProperties.toImmutable(), ) @@ -42141,17 +46395,17 @@ constructor( return true } - return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && metadata == other.metadata && externalPriceId == other.externalPriceId && name == other.name && billableMetricId == other.billableMetricId && itemId == other.itemId && billedInAdvance == other.billedInAdvance && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && cadence == other.cadence && billingCycleConfiguration == other.billingCycleConfiguration && invoicingCycleConfiguration == other.invoicingCycleConfiguration && conversionRate == other.conversionRate && modelType == other.modelType && bulkWithProrationConfig == other.bulkWithProrationConfig && currency == other.currency && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewSubscriptionBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && currency == other.currency && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, bulkWithProrationConfig, currency, referenceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, currency, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewSubscriptionBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, referenceId=$referenceId, additionalProperties=$additionalProperties}" + "NewSubscriptionBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, currency=$currency, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } } @@ -42160,17 +46414,17 @@ constructor( return true } - return /* spotless:off */ other is ReplacePrice && priceId == other.priceId && externalPriceId == other.externalPriceId && price == other.price && fixedPriceQuantity == other.fixedPriceQuantity && replacesPriceId == other.replacesPriceId && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && discounts == other.discounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ReplacePrice && replacesPriceId == other.replacesPriceId && discounts == other.discounts && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, externalPriceId, price, fixedPriceQuantity, replacesPriceId, minimumAmount, maximumAmount, discounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(replacesPriceId, discounts, externalPriceId, fixedPriceQuantity, maximumAmount, minimumAmount, price, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ReplacePrice{priceId=$priceId, externalPriceId=$externalPriceId, price=$price, fixedPriceQuantity=$fixedPriceQuantity, replacesPriceId=$replacesPriceId, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, discounts=$discounts, additionalProperties=$additionalProperties}" + "ReplacePrice{replacesPriceId=$replacesPriceId, discounts=$discounts, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt index bbcb97f0..b6fb1c25 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionSchedulePlanChangeResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionSchedulePlanChangeResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,89 +419,174 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( subscriptionSchedulePlanChangeResponse: SubscriptionSchedulePlanChangeResponse ) = apply { - metadata = subscriptionSchedulePlanChangeResponse.metadata id = subscriptionSchedulePlanChangeResponse.id - customer = subscriptionSchedulePlanChangeResponse.customer - plan = subscriptionSchedulePlanChangeResponse.plan - startDate = subscriptionSchedulePlanChangeResponse.startDate - endDate = subscriptionSchedulePlanChangeResponse.endDate + activePlanPhaseOrder = subscriptionSchedulePlanChangeResponse.activePlanPhaseOrder + adjustmentIntervals = subscriptionSchedulePlanChangeResponse.adjustmentIntervals + autoCollection = subscriptionSchedulePlanChangeResponse.autoCollection + billingCycleAnchorConfiguration = + subscriptionSchedulePlanChangeResponse.billingCycleAnchorConfiguration + billingCycleDay = subscriptionSchedulePlanChangeResponse.billingCycleDay createdAt = subscriptionSchedulePlanChangeResponse.createdAt - currentBillingPeriodStartDate = - subscriptionSchedulePlanChangeResponse.currentBillingPeriodStartDate currentBillingPeriodEndDate = subscriptionSchedulePlanChangeResponse.currentBillingPeriodEndDate - status = subscriptionSchedulePlanChangeResponse.status - trialInfo = subscriptionSchedulePlanChangeResponse.trialInfo - activePlanPhaseOrder = subscriptionSchedulePlanChangeResponse.activePlanPhaseOrder + currentBillingPeriodStartDate = + subscriptionSchedulePlanChangeResponse.currentBillingPeriodStartDate + customer = subscriptionSchedulePlanChangeResponse.customer + defaultInvoiceMemo = subscriptionSchedulePlanChangeResponse.defaultInvoiceMemo + discountIntervals = subscriptionSchedulePlanChangeResponse.discountIntervals + endDate = subscriptionSchedulePlanChangeResponse.endDate fixedFeeQuantitySchedule = subscriptionSchedulePlanChangeResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionSchedulePlanChangeResponse.defaultInvoiceMemo - autoCollection = subscriptionSchedulePlanChangeResponse.autoCollection - netTerms = subscriptionSchedulePlanChangeResponse.netTerms - redeemedCoupon = subscriptionSchedulePlanChangeResponse.redeemedCoupon - billingCycleDay = subscriptionSchedulePlanChangeResponse.billingCycleDay - billingCycleAnchorConfiguration = - subscriptionSchedulePlanChangeResponse.billingCycleAnchorConfiguration invoicingThreshold = subscriptionSchedulePlanChangeResponse.invoicingThreshold - priceIntervals = subscriptionSchedulePlanChangeResponse.priceIntervals - adjustmentIntervals = subscriptionSchedulePlanChangeResponse.adjustmentIntervals - discountIntervals = subscriptionSchedulePlanChangeResponse.discountIntervals - minimumIntervals = subscriptionSchedulePlanChangeResponse.minimumIntervals maximumIntervals = subscriptionSchedulePlanChangeResponse.maximumIntervals + metadata = subscriptionSchedulePlanChangeResponse.metadata + minimumIntervals = subscriptionSchedulePlanChangeResponse.minimumIntervals + netTerms = subscriptionSchedulePlanChangeResponse.netTerms + plan = subscriptionSchedulePlanChangeResponse.plan + priceIntervals = subscriptionSchedulePlanChangeResponse.priceIntervals + redeemedCoupon = subscriptionSchedulePlanChangeResponse.redeemedCoupon + startDate = subscriptionSchedulePlanChangeResponse.startDate + status = subscriptionSchedulePlanChangeResponse.status + trialInfo = subscriptionSchedulePlanChangeResponse.trialInfo additionalProperties = subscriptionSchedulePlanChangeResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -538,94 +623,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -634,35 +665,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -679,45 +718,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -728,41 +743,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -785,31 +785,31 @@ private constructor( fun build(): SubscriptionSchedulePlanChangeResponse = SubscriptionSchedulePlanChangeResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -822,15 +822,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -839,32 +839,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -875,9 +875,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -893,18 +893,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -918,20 +918,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -942,6 +928,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -965,9 +965,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1221,30 +1221,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1255,22 +1267,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1285,26 +1302,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1314,12 +1314,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1334,23 +1334,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1359,6 +1359,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1383,43 +1414,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1445,12 +1445,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1512,17 +1512,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1532,48 +1532,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1582,32 +1575,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1617,6 +1609,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1626,12 +1626,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1646,24 +1646,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1672,28 +1672,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1705,17 +1688,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1733,6 +1718,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1758,12 +1758,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1825,17 +1825,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1845,21 +1845,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1869,6 +1869,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1879,15 +1885,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1896,6 +1896,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1909,18 +1918,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1936,11 +1936,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1956,22 +1956,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1981,6 +1981,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2005,28 +2021,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2067,11 +2067,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2134,17 +2134,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2154,51 +2154,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2206,35 +2202,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2242,8 +2237,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2254,13 +2254,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2275,25 +2275,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2301,6 +2301,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2316,36 +2332,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2362,11 +2353,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2393,13 +2393,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2461,17 +2461,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2481,56 +2481,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2540,29 +2549,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2572,12 +2572,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2592,23 +2592,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2616,28 +2616,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2649,17 +2632,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2677,6 +2662,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2702,12 +2702,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2769,17 +2769,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2788,17 +2788,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3163,40 +3163,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3205,16 +3196,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3226,6 +3218,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3234,12 +3234,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3253,33 +3253,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3289,20 +3282,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3322,6 +3301,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3346,12 +3346,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3412,57 +3412,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3471,18 +3459,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3494,6 +3481,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3502,12 +3502,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3521,52 +3521,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3575,24 +3573,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3618,12 +3618,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3684,60 +3684,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3746,19 +3731,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3770,6 +3756,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3778,12 +3778,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3797,25 +3797,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3823,6 +3842,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3838,39 +3871,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3895,12 +3895,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3961,17 +3961,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3979,39 +3979,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4020,10 +4020,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4037,39 +4037,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4091,10 +4091,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4104,49 +4104,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4155,6 +4148,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4162,10 +4159,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4177,12 +4171,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4191,11 +4191,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4209,37 +4209,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4259,6 +4245,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4273,6 +4265,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4294,11 +4294,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4308,17 +4308,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4405,32 +4405,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4439,6 +4432,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4446,10 +4443,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4461,12 +4455,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4475,11 +4475,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4493,37 +4493,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4543,6 +4529,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4557,6 +4549,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4578,11 +4578,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4592,17 +4592,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4614,39 +4614,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4655,6 +4672,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4885,51 +4911,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5161,34 +5184,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5199,13 +5199,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5220,26 +5220,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5247,19 +5247,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5273,6 +5302,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5733,64 +5778,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5814,13 +5814,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5829,12 +5829,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5842,16 +5842,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5862,8 +5862,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5878,24 +5878,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5903,6 +5899,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5931,8 +5931,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5943,17 +5943,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5961,17 +5961,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5981,29 +5981,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6013,8 +6013,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6029,15 +6029,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6045,16 +6045,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6077,8 +6077,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6088,17 +6088,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6260,15 +6260,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionSchedulePlanChangeResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionSchedulePlanChangeResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionSchedulePlanChangeResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionSchedulePlanChangeResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt index d02d59f8..eb5a43ca 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt @@ -95,10 +95,17 @@ constructor( * The date on which the phase change should take effect. If not provided, defaults to * today in the customer's timezone. */ - fun effectiveDate(effectiveDate: LocalDate) = apply { + fun effectiveDate(effectiveDate: LocalDate?) = apply { this.effectiveDate = effectiveDate } + /** + * The date on which the phase change should take effect. If not provided, defaults to + * today in the customer's timezone. + */ + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -170,7 +177,14 @@ constructor( * The date on which the phase change should take effect. If not provided, defaults to today * in the customer's timezone. */ - fun effectiveDate(effectiveDate: LocalDate) = apply { body.effectiveDate(effectiveDate) } + fun effectiveDate(effectiveDate: LocalDate?) = apply { body.effectiveDate(effectiveDate) } + + /** + * The date on which the phase change should take effect. If not provided, defaults to today + * in the customer's timezone. + */ + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt index 101559a2..7d9d66b5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionTriggerPhaseResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionTriggerPhaseResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,87 +419,172 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionTriggerPhaseResponse: SubscriptionTriggerPhaseResponse) = apply { - metadata = subscriptionTriggerPhaseResponse.metadata id = subscriptionTriggerPhaseResponse.id - customer = subscriptionTriggerPhaseResponse.customer - plan = subscriptionTriggerPhaseResponse.plan - startDate = subscriptionTriggerPhaseResponse.startDate - endDate = subscriptionTriggerPhaseResponse.endDate - createdAt = subscriptionTriggerPhaseResponse.createdAt - currentBillingPeriodStartDate = - subscriptionTriggerPhaseResponse.currentBillingPeriodStartDate - currentBillingPeriodEndDate = - subscriptionTriggerPhaseResponse.currentBillingPeriodEndDate - status = subscriptionTriggerPhaseResponse.status - trialInfo = subscriptionTriggerPhaseResponse.trialInfo activePlanPhaseOrder = subscriptionTriggerPhaseResponse.activePlanPhaseOrder - fixedFeeQuantitySchedule = subscriptionTriggerPhaseResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionTriggerPhaseResponse.defaultInvoiceMemo + adjustmentIntervals = subscriptionTriggerPhaseResponse.adjustmentIntervals autoCollection = subscriptionTriggerPhaseResponse.autoCollection - netTerms = subscriptionTriggerPhaseResponse.netTerms - redeemedCoupon = subscriptionTriggerPhaseResponse.redeemedCoupon - billingCycleDay = subscriptionTriggerPhaseResponse.billingCycleDay billingCycleAnchorConfiguration = subscriptionTriggerPhaseResponse.billingCycleAnchorConfiguration - invoicingThreshold = subscriptionTriggerPhaseResponse.invoicingThreshold - priceIntervals = subscriptionTriggerPhaseResponse.priceIntervals - adjustmentIntervals = subscriptionTriggerPhaseResponse.adjustmentIntervals + billingCycleDay = subscriptionTriggerPhaseResponse.billingCycleDay + createdAt = subscriptionTriggerPhaseResponse.createdAt + currentBillingPeriodEndDate = + subscriptionTriggerPhaseResponse.currentBillingPeriodEndDate + currentBillingPeriodStartDate = + subscriptionTriggerPhaseResponse.currentBillingPeriodStartDate + customer = subscriptionTriggerPhaseResponse.customer + defaultInvoiceMemo = subscriptionTriggerPhaseResponse.defaultInvoiceMemo discountIntervals = subscriptionTriggerPhaseResponse.discountIntervals - minimumIntervals = subscriptionTriggerPhaseResponse.minimumIntervals + endDate = subscriptionTriggerPhaseResponse.endDate + fixedFeeQuantitySchedule = subscriptionTriggerPhaseResponse.fixedFeeQuantitySchedule + invoicingThreshold = subscriptionTriggerPhaseResponse.invoicingThreshold maximumIntervals = subscriptionTriggerPhaseResponse.maximumIntervals + metadata = subscriptionTriggerPhaseResponse.metadata + minimumIntervals = subscriptionTriggerPhaseResponse.minimumIntervals + netTerms = subscriptionTriggerPhaseResponse.netTerms + plan = subscriptionTriggerPhaseResponse.plan + priceIntervals = subscriptionTriggerPhaseResponse.priceIntervals + redeemedCoupon = subscriptionTriggerPhaseResponse.redeemedCoupon + startDate = subscriptionTriggerPhaseResponse.startDate + status = subscriptionTriggerPhaseResponse.status + trialInfo = subscriptionTriggerPhaseResponse.trialInfo additionalProperties = subscriptionTriggerPhaseResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -536,94 +621,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -632,35 +663,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -677,45 +716,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -726,41 +741,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -783,31 +783,31 @@ private constructor( fun build(): SubscriptionTriggerPhaseResponse = SubscriptionTriggerPhaseResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -820,15 +820,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -837,32 +837,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -873,9 +873,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -891,18 +891,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -916,20 +916,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -940,6 +926,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -963,9 +963,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1219,30 +1219,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1253,22 +1265,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1283,26 +1300,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1312,12 +1312,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1332,23 +1332,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1357,6 +1357,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1381,43 +1412,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1443,12 +1443,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1510,17 +1510,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1530,48 +1530,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1580,32 +1573,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1615,6 +1607,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1624,12 +1624,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1644,24 +1644,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1670,28 +1670,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1703,17 +1686,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1731,6 +1716,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1756,12 +1756,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1823,17 +1823,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1843,21 +1843,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1867,6 +1867,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1877,15 +1883,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1894,6 +1894,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1907,18 +1916,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1934,11 +1934,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1954,22 +1954,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1979,6 +1979,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2003,28 +2019,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2065,11 +2065,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2132,17 +2132,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2152,51 +2152,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2204,35 +2200,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2240,8 +2235,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2252,13 +2252,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2273,25 +2273,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2299,6 +2299,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2314,36 +2330,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2360,11 +2351,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2391,13 +2391,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2459,17 +2459,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2479,56 +2479,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2538,29 +2547,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2570,12 +2570,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2590,23 +2590,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2614,28 +2614,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2647,17 +2630,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2675,6 +2660,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2700,12 +2700,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2767,17 +2767,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2786,17 +2786,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3161,40 +3161,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3203,16 +3194,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3224,6 +3216,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3232,12 +3232,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3251,33 +3251,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3287,20 +3280,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3320,6 +3299,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3344,12 +3344,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3410,57 +3410,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3469,18 +3457,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3492,6 +3479,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3500,12 +3500,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3519,52 +3519,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3573,24 +3571,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3616,12 +3616,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3682,60 +3682,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3744,19 +3729,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3768,6 +3754,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3776,12 +3776,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3795,25 +3795,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3821,6 +3840,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3836,39 +3869,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3893,12 +3893,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3959,17 +3959,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3977,39 +3977,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4018,10 +4018,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4035,39 +4035,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4089,10 +4089,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4102,49 +4102,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4153,6 +4146,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4160,10 +4157,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4175,12 +4169,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4189,11 +4189,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4207,37 +4207,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4257,6 +4243,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4271,6 +4263,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4292,11 +4292,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4306,17 +4306,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4403,32 +4403,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4437,6 +4430,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4444,10 +4441,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4459,12 +4453,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4473,11 +4473,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4491,37 +4491,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4541,6 +4527,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4555,6 +4547,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4576,11 +4576,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4590,17 +4590,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4612,39 +4612,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4653,6 +4670,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4883,51 +4909,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5159,34 +5182,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5197,13 +5197,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5218,26 +5218,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5245,19 +5245,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5271,6 +5300,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5731,64 +5776,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5812,13 +5812,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5827,12 +5827,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5840,16 +5840,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5860,8 +5860,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5876,24 +5876,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5901,6 +5897,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5929,8 +5929,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5941,17 +5941,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5959,17 +5959,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5979,29 +5979,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6011,8 +6011,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6027,15 +6027,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6043,16 +6043,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6075,8 +6075,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6086,17 +6086,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6258,15 +6258,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionTriggerPhaseResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionTriggerPhaseResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionTriggerPhaseResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionTriggerPhaseResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt index 6b89aabe..005309db 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionUnscheduleCancellationResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionUnscheduleCancellationResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,89 +419,174 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( subscriptionUnscheduleCancellationResponse: SubscriptionUnscheduleCancellationResponse ) = apply { - metadata = subscriptionUnscheduleCancellationResponse.metadata id = subscriptionUnscheduleCancellationResponse.id - customer = subscriptionUnscheduleCancellationResponse.customer - plan = subscriptionUnscheduleCancellationResponse.plan - startDate = subscriptionUnscheduleCancellationResponse.startDate - endDate = subscriptionUnscheduleCancellationResponse.endDate + activePlanPhaseOrder = subscriptionUnscheduleCancellationResponse.activePlanPhaseOrder + adjustmentIntervals = subscriptionUnscheduleCancellationResponse.adjustmentIntervals + autoCollection = subscriptionUnscheduleCancellationResponse.autoCollection + billingCycleAnchorConfiguration = + subscriptionUnscheduleCancellationResponse.billingCycleAnchorConfiguration + billingCycleDay = subscriptionUnscheduleCancellationResponse.billingCycleDay createdAt = subscriptionUnscheduleCancellationResponse.createdAt - currentBillingPeriodStartDate = - subscriptionUnscheduleCancellationResponse.currentBillingPeriodStartDate currentBillingPeriodEndDate = subscriptionUnscheduleCancellationResponse.currentBillingPeriodEndDate - status = subscriptionUnscheduleCancellationResponse.status - trialInfo = subscriptionUnscheduleCancellationResponse.trialInfo - activePlanPhaseOrder = subscriptionUnscheduleCancellationResponse.activePlanPhaseOrder + currentBillingPeriodStartDate = + subscriptionUnscheduleCancellationResponse.currentBillingPeriodStartDate + customer = subscriptionUnscheduleCancellationResponse.customer + defaultInvoiceMemo = subscriptionUnscheduleCancellationResponse.defaultInvoiceMemo + discountIntervals = subscriptionUnscheduleCancellationResponse.discountIntervals + endDate = subscriptionUnscheduleCancellationResponse.endDate fixedFeeQuantitySchedule = subscriptionUnscheduleCancellationResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionUnscheduleCancellationResponse.defaultInvoiceMemo - autoCollection = subscriptionUnscheduleCancellationResponse.autoCollection - netTerms = subscriptionUnscheduleCancellationResponse.netTerms - redeemedCoupon = subscriptionUnscheduleCancellationResponse.redeemedCoupon - billingCycleDay = subscriptionUnscheduleCancellationResponse.billingCycleDay - billingCycleAnchorConfiguration = - subscriptionUnscheduleCancellationResponse.billingCycleAnchorConfiguration invoicingThreshold = subscriptionUnscheduleCancellationResponse.invoicingThreshold - priceIntervals = subscriptionUnscheduleCancellationResponse.priceIntervals - adjustmentIntervals = subscriptionUnscheduleCancellationResponse.adjustmentIntervals - discountIntervals = subscriptionUnscheduleCancellationResponse.discountIntervals - minimumIntervals = subscriptionUnscheduleCancellationResponse.minimumIntervals maximumIntervals = subscriptionUnscheduleCancellationResponse.maximumIntervals + metadata = subscriptionUnscheduleCancellationResponse.metadata + minimumIntervals = subscriptionUnscheduleCancellationResponse.minimumIntervals + netTerms = subscriptionUnscheduleCancellationResponse.netTerms + plan = subscriptionUnscheduleCancellationResponse.plan + priceIntervals = subscriptionUnscheduleCancellationResponse.priceIntervals + redeemedCoupon = subscriptionUnscheduleCancellationResponse.redeemedCoupon + startDate = subscriptionUnscheduleCancellationResponse.startDate + status = subscriptionUnscheduleCancellationResponse.status + trialInfo = subscriptionUnscheduleCancellationResponse.trialInfo additionalProperties = subscriptionUnscheduleCancellationResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -538,94 +623,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -634,35 +665,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -679,45 +718,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -728,41 +743,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -785,31 +785,31 @@ private constructor( fun build(): SubscriptionUnscheduleCancellationResponse = SubscriptionUnscheduleCancellationResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -822,15 +822,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -839,32 +839,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -875,9 +875,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -893,18 +893,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -918,20 +918,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -942,6 +928,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -965,9 +965,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1221,30 +1221,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1255,22 +1267,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1285,26 +1302,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1314,12 +1314,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1334,23 +1334,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1359,6 +1359,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1383,43 +1414,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1445,12 +1445,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1512,17 +1512,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1532,48 +1532,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1582,32 +1575,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1617,6 +1609,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1626,12 +1626,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1646,24 +1646,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1672,28 +1672,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1705,17 +1688,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1733,6 +1718,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1758,12 +1758,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1825,17 +1825,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1845,21 +1845,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1869,6 +1869,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1879,15 +1885,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1896,6 +1896,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1909,18 +1918,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1936,11 +1936,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1956,22 +1956,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1981,6 +1981,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2005,28 +2021,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2067,11 +2067,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2134,17 +2134,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2154,51 +2154,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2206,35 +2202,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2242,8 +2237,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2254,13 +2254,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2275,25 +2275,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2301,6 +2301,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2316,36 +2332,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2362,11 +2353,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2393,13 +2393,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2461,17 +2461,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2481,56 +2481,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2540,29 +2549,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2572,12 +2572,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2592,23 +2592,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2616,28 +2616,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2649,17 +2632,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2677,6 +2662,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2702,12 +2702,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2769,17 +2769,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2788,17 +2788,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3163,40 +3163,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3205,16 +3196,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3226,6 +3218,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3234,12 +3234,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3253,33 +3253,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3289,20 +3282,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3322,6 +3301,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3346,12 +3346,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3412,57 +3412,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3471,18 +3459,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3494,6 +3481,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3502,12 +3502,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3521,52 +3521,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3575,24 +3573,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3618,12 +3618,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3684,60 +3684,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3746,19 +3731,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3770,6 +3756,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3778,12 +3778,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3797,25 +3797,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3823,6 +3842,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3838,39 +3871,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3895,12 +3895,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3961,17 +3961,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3979,39 +3979,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4020,10 +4020,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4037,39 +4037,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4091,10 +4091,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4104,49 +4104,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4155,6 +4148,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4162,10 +4159,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4177,12 +4171,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4191,11 +4191,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4209,37 +4209,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4259,6 +4245,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4273,6 +4265,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4294,11 +4294,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4308,17 +4308,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4405,32 +4405,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4439,6 +4432,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4446,10 +4443,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4461,12 +4455,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4475,11 +4475,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4493,37 +4493,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4543,6 +4529,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4557,6 +4549,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4578,11 +4578,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4592,17 +4592,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4614,39 +4614,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4655,6 +4672,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4885,51 +4911,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5161,34 +5184,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5199,13 +5199,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5220,26 +5220,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5247,19 +5247,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5273,6 +5302,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5733,64 +5778,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5814,13 +5814,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5829,12 +5829,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5842,16 +5842,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5862,8 +5862,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5878,24 +5878,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5903,6 +5899,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5931,8 +5931,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5943,17 +5943,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5961,17 +5961,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5981,29 +5981,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6013,8 +6013,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6029,15 +6029,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6045,16 +6045,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6077,8 +6077,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6088,17 +6088,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6260,15 +6260,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUnscheduleCancellationResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUnscheduleCancellationResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUnscheduleCancellationResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionUnscheduleCancellationResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt index c24c7fdf..f8edcee5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,33 +419,33 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -453,65 +453,150 @@ private constructor( subscriptionUnscheduleFixedFeeQuantityUpdatesResponse: SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse ) = apply { - metadata = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.metadata id = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.id - customer = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.customer - plan = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.plan - startDate = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.startDate - endDate = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.endDate - createdAt = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.createdAt - currentBillingPeriodStartDate = - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.currentBillingPeriodStartDate - currentBillingPeriodEndDate = - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.currentBillingPeriodEndDate - status = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.status - trialInfo = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.trialInfo activePlanPhaseOrder = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.activePlanPhaseOrder - fixedFeeQuantitySchedule = - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.defaultInvoiceMemo + adjustmentIntervals = + subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.adjustmentIntervals autoCollection = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.autoCollection - netTerms = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.netTerms - redeemedCoupon = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.redeemedCoupon - billingCycleDay = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.billingCycleDay billingCycleAnchorConfiguration = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse .billingCycleAnchorConfiguration - invoicingThreshold = - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.invoicingThreshold - priceIntervals = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.priceIntervals - adjustmentIntervals = - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.adjustmentIntervals + billingCycleDay = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.billingCycleDay + createdAt = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.createdAt + currentBillingPeriodEndDate = + subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.currentBillingPeriodEndDate + currentBillingPeriodStartDate = + subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.currentBillingPeriodStartDate + customer = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.customer + defaultInvoiceMemo = + subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.defaultInvoiceMemo discountIntervals = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.discountIntervals - minimumIntervals = - subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.minimumIntervals + endDate = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.endDate + fixedFeeQuantitySchedule = + subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.fixedFeeQuantitySchedule + invoicingThreshold = + subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.invoicingThreshold maximumIntervals = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.maximumIntervals + metadata = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.metadata + minimumIntervals = + subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.minimumIntervals + netTerms = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.netTerms + plan = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.plan + priceIntervals = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.priceIntervals + redeemedCoupon = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.redeemedCoupon + startDate = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.startDate + status = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.status + trialInfo = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.trialInfo additionalProperties = subscriptionUnscheduleFixedFeeQuantityUpdatesResponse.additionalProperties .toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -548,94 +633,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -644,35 +675,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -689,45 +728,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -738,41 +753,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -795,31 +795,31 @@ private constructor( fun build(): SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse = SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -832,15 +832,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -849,32 +849,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -885,9 +885,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -903,18 +903,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -928,20 +928,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -952,6 +938,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -975,9 +975,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1231,30 +1231,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1265,22 +1277,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1295,26 +1312,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1324,12 +1324,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1344,23 +1344,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1369,6 +1369,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1393,43 +1424,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1455,12 +1455,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1522,17 +1522,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1542,48 +1542,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1592,32 +1585,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1627,6 +1619,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1636,12 +1636,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1656,24 +1656,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1682,28 +1682,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1715,17 +1698,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1743,6 +1728,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1768,12 +1768,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1835,17 +1835,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1855,21 +1855,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1879,6 +1879,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1889,15 +1895,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1906,6 +1906,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1919,18 +1928,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1946,11 +1946,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1966,22 +1966,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1991,6 +1991,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2015,28 +2031,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2077,11 +2077,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2144,17 +2144,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2164,51 +2164,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2216,35 +2212,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2252,8 +2247,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2264,13 +2264,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2285,25 +2285,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2311,6 +2311,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2326,36 +2342,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2372,11 +2363,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2403,13 +2403,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2471,17 +2471,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2491,56 +2491,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2550,29 +2559,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2582,12 +2582,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2602,23 +2602,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2626,28 +2626,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2659,17 +2642,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2687,6 +2672,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2712,12 +2712,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2779,17 +2779,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2798,17 +2798,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3173,40 +3173,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3215,16 +3206,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3236,6 +3228,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3244,12 +3244,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3263,33 +3263,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3299,20 +3292,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3332,6 +3311,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3356,12 +3356,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3422,57 +3422,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3481,18 +3469,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3504,6 +3491,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3512,12 +3512,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3531,52 +3531,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3585,24 +3583,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3628,12 +3628,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3694,60 +3694,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3756,19 +3741,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3780,6 +3766,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3788,12 +3788,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3807,25 +3807,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3833,6 +3852,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3848,39 +3881,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3905,12 +3905,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3971,17 +3971,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3989,39 +3989,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4030,10 +4030,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4047,39 +4047,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4101,10 +4101,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4114,49 +4114,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4165,6 +4158,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4172,10 +4169,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4187,12 +4181,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4201,11 +4201,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4219,37 +4219,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4269,6 +4255,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4283,6 +4275,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4304,11 +4304,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4318,17 +4318,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4415,32 +4415,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4449,6 +4442,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4456,10 +4453,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4471,12 +4465,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4485,11 +4485,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4503,37 +4503,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4553,6 +4539,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4567,6 +4559,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4588,11 +4588,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4602,17 +4602,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4624,39 +4624,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4665,6 +4682,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4895,51 +4921,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5171,34 +5194,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5209,13 +5209,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5230,26 +5230,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5257,19 +5257,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5283,6 +5312,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5743,64 +5788,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5824,13 +5824,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5839,12 +5839,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5852,16 +5852,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5872,8 +5872,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5888,24 +5888,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5913,6 +5909,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5941,8 +5941,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5953,17 +5953,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5971,17 +5971,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5991,29 +5991,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6023,8 +6023,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6039,15 +6039,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6055,16 +6055,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6087,8 +6087,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6098,17 +6098,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6270,15 +6270,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt index d5bc8663..ce81da9f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionUnschedulePendingPlanChangesResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionUnschedulePendingPlanChangesResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,33 +419,33 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -453,58 +453,143 @@ private constructor( subscriptionUnschedulePendingPlanChangesResponse: SubscriptionUnschedulePendingPlanChangesResponse ) = apply { - metadata = subscriptionUnschedulePendingPlanChangesResponse.metadata id = subscriptionUnschedulePendingPlanChangesResponse.id - customer = subscriptionUnschedulePendingPlanChangesResponse.customer - plan = subscriptionUnschedulePendingPlanChangesResponse.plan - startDate = subscriptionUnschedulePendingPlanChangesResponse.startDate - endDate = subscriptionUnschedulePendingPlanChangesResponse.endDate - createdAt = subscriptionUnschedulePendingPlanChangesResponse.createdAt - currentBillingPeriodStartDate = - subscriptionUnschedulePendingPlanChangesResponse.currentBillingPeriodStartDate - currentBillingPeriodEndDate = - subscriptionUnschedulePendingPlanChangesResponse.currentBillingPeriodEndDate - status = subscriptionUnschedulePendingPlanChangesResponse.status - trialInfo = subscriptionUnschedulePendingPlanChangesResponse.trialInfo activePlanPhaseOrder = subscriptionUnschedulePendingPlanChangesResponse.activePlanPhaseOrder - fixedFeeQuantitySchedule = - subscriptionUnschedulePendingPlanChangesResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionUnschedulePendingPlanChangesResponse.defaultInvoiceMemo + adjustmentIntervals = + subscriptionUnschedulePendingPlanChangesResponse.adjustmentIntervals autoCollection = subscriptionUnschedulePendingPlanChangesResponse.autoCollection - netTerms = subscriptionUnschedulePendingPlanChangesResponse.netTerms - redeemedCoupon = subscriptionUnschedulePendingPlanChangesResponse.redeemedCoupon - billingCycleDay = subscriptionUnschedulePendingPlanChangesResponse.billingCycleDay billingCycleAnchorConfiguration = subscriptionUnschedulePendingPlanChangesResponse.billingCycleAnchorConfiguration - invoicingThreshold = subscriptionUnschedulePendingPlanChangesResponse.invoicingThreshold - priceIntervals = subscriptionUnschedulePendingPlanChangesResponse.priceIntervals - adjustmentIntervals = - subscriptionUnschedulePendingPlanChangesResponse.adjustmentIntervals + billingCycleDay = subscriptionUnschedulePendingPlanChangesResponse.billingCycleDay + createdAt = subscriptionUnschedulePendingPlanChangesResponse.createdAt + currentBillingPeriodEndDate = + subscriptionUnschedulePendingPlanChangesResponse.currentBillingPeriodEndDate + currentBillingPeriodStartDate = + subscriptionUnschedulePendingPlanChangesResponse.currentBillingPeriodStartDate + customer = subscriptionUnschedulePendingPlanChangesResponse.customer + defaultInvoiceMemo = subscriptionUnschedulePendingPlanChangesResponse.defaultInvoiceMemo discountIntervals = subscriptionUnschedulePendingPlanChangesResponse.discountIntervals - minimumIntervals = subscriptionUnschedulePendingPlanChangesResponse.minimumIntervals + endDate = subscriptionUnschedulePendingPlanChangesResponse.endDate + fixedFeeQuantitySchedule = + subscriptionUnschedulePendingPlanChangesResponse.fixedFeeQuantitySchedule + invoicingThreshold = subscriptionUnschedulePendingPlanChangesResponse.invoicingThreshold maximumIntervals = subscriptionUnschedulePendingPlanChangesResponse.maximumIntervals + metadata = subscriptionUnschedulePendingPlanChangesResponse.metadata + minimumIntervals = subscriptionUnschedulePendingPlanChangesResponse.minimumIntervals + netTerms = subscriptionUnschedulePendingPlanChangesResponse.netTerms + plan = subscriptionUnschedulePendingPlanChangesResponse.plan + priceIntervals = subscriptionUnschedulePendingPlanChangesResponse.priceIntervals + redeemedCoupon = subscriptionUnschedulePendingPlanChangesResponse.redeemedCoupon + startDate = subscriptionUnschedulePendingPlanChangesResponse.startDate + status = subscriptionUnschedulePendingPlanChangesResponse.status + trialInfo = subscriptionUnschedulePendingPlanChangesResponse.trialInfo additionalProperties = subscriptionUnschedulePendingPlanChangesResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -541,94 +626,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -637,35 +668,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -682,45 +721,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -731,41 +746,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -788,31 +788,31 @@ private constructor( fun build(): SubscriptionUnschedulePendingPlanChangesResponse = SubscriptionUnschedulePendingPlanChangesResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -825,15 +825,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -842,32 +842,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -878,9 +878,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -896,18 +896,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -921,20 +921,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -945,6 +931,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -968,9 +968,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1224,30 +1224,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1258,22 +1270,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1288,26 +1305,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1317,12 +1317,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1337,23 +1337,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1362,6 +1362,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1386,43 +1417,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1448,12 +1448,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1515,17 +1515,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1535,48 +1535,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1585,32 +1578,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1620,6 +1612,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1629,12 +1629,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1649,24 +1649,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1675,28 +1675,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1708,17 +1691,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1736,6 +1721,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1761,12 +1761,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1828,17 +1828,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1848,21 +1848,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1872,6 +1872,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1882,15 +1888,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1899,6 +1899,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1912,18 +1921,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1939,11 +1939,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1959,22 +1959,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1984,6 +1984,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2008,28 +2024,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2070,11 +2070,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2137,17 +2137,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2157,51 +2157,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2209,35 +2205,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2245,8 +2240,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2257,13 +2257,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2278,25 +2278,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2304,6 +2304,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2319,36 +2335,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2365,11 +2356,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2396,13 +2396,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2464,17 +2464,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2484,56 +2484,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2543,29 +2552,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2575,12 +2575,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2595,23 +2595,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2619,28 +2619,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2652,17 +2635,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2680,6 +2665,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2705,12 +2705,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2772,17 +2772,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2791,17 +2791,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3166,40 +3166,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3208,16 +3199,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3229,6 +3221,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3237,12 +3237,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3256,33 +3256,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3292,20 +3285,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3325,6 +3304,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3349,12 +3349,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3415,57 +3415,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3474,18 +3462,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3497,6 +3484,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3505,12 +3505,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3524,52 +3524,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3578,24 +3576,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3621,12 +3621,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3687,60 +3687,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3749,19 +3734,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3773,6 +3759,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3781,12 +3781,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3800,25 +3800,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3826,6 +3845,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3841,39 +3874,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3898,12 +3898,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3964,17 +3964,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3982,39 +3982,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4023,10 +4023,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4040,39 +4040,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4094,10 +4094,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4107,49 +4107,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4158,6 +4151,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4165,10 +4162,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4180,12 +4174,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4194,11 +4194,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4212,37 +4212,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4262,6 +4248,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4276,6 +4268,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4297,11 +4297,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4311,17 +4311,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4408,32 +4408,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4442,6 +4435,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4449,10 +4446,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4464,12 +4458,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4478,11 +4478,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4496,37 +4496,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4546,6 +4532,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4560,6 +4552,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4581,11 +4581,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4595,17 +4595,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4617,39 +4617,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4658,6 +4675,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4888,51 +4914,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5164,34 +5187,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5202,13 +5202,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5223,26 +5223,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5250,19 +5250,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5276,6 +5305,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5736,64 +5781,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5817,13 +5817,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5832,12 +5832,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5845,16 +5845,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5865,8 +5865,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5881,24 +5881,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5906,6 +5902,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5934,8 +5934,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5946,17 +5946,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5964,17 +5964,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5984,29 +5984,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6016,8 +6016,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6032,15 +6032,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6048,16 +6048,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6080,8 +6080,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6091,17 +6091,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6263,15 +6263,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUnschedulePendingPlanChangesResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUnschedulePendingPlanChangesResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUnschedulePendingPlanChangesResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionUnschedulePendingPlanChangesResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt index 2c0e9ba4..46513293 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt @@ -142,19 +142,35 @@ constructor( * this defaults to `effective_date`. Otherwise, this defaults to `immediate` unless * it's explicitly set to `upcoming_invoice. */ - fun changeOption(changeOption: ChangeOption) = apply { + fun changeOption(changeOption: ChangeOption?) = apply { this.changeOption = changeOption } + /** + * Determines when the change takes effect. Note that if `effective_date` is specified, + * this defaults to `effective_date`. Otherwise, this defaults to `immediate` unless + * it's explicitly set to `upcoming_invoice. + */ + fun changeOption(changeOption: Optional) = + changeOption(changeOption.orElse(null)) + /** * The date that the quantity change should take effect, localized to the customer's * timezone. Ifthis parameter is not passed in, the quantity change is effective * according to `change_option`. */ - fun effectiveDate(effectiveDate: LocalDate) = apply { + fun effectiveDate(effectiveDate: LocalDate?) = apply { this.effectiveDate = effectiveDate } + /** + * The date that the quantity change should take effect, localized to the customer's + * timezone. Ifthis parameter is not passed in, the quantity change is effective + * according to `change_option`. + */ + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -242,14 +258,30 @@ constructor( * defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's * explicitly set to `upcoming_invoice. */ - fun changeOption(changeOption: ChangeOption) = apply { body.changeOption(changeOption) } + fun changeOption(changeOption: ChangeOption?) = apply { body.changeOption(changeOption) } + + /** + * Determines when the change takes effect. Note that if `effective_date` is specified, this + * defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's + * explicitly set to `upcoming_invoice. + */ + fun changeOption(changeOption: Optional) = + changeOption(changeOption.orElse(null)) + + /** + * The date that the quantity change should take effect, localized to the customer's + * timezone. Ifthis parameter is not passed in, the quantity change is effective according + * to `change_option`. + */ + fun effectiveDate(effectiveDate: LocalDate?) = apply { body.effectiveDate(effectiveDate) } /** * The date that the quantity change should take effect, localized to the customer's * timezone. Ifthis parameter is not passed in, the quantity change is effective according * to `change_option`. */ - fun effectiveDate(effectiveDate: LocalDate) = apply { body.effectiveDate(effectiveDate) } + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt index a796dbe1..0330da3e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionUpdateFixedFeeQuantityResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionUpdateFixedFeeQuantityResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,89 +419,174 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( subscriptionUpdateFixedFeeQuantityResponse: SubscriptionUpdateFixedFeeQuantityResponse ) = apply { - metadata = subscriptionUpdateFixedFeeQuantityResponse.metadata id = subscriptionUpdateFixedFeeQuantityResponse.id - customer = subscriptionUpdateFixedFeeQuantityResponse.customer - plan = subscriptionUpdateFixedFeeQuantityResponse.plan - startDate = subscriptionUpdateFixedFeeQuantityResponse.startDate - endDate = subscriptionUpdateFixedFeeQuantityResponse.endDate + activePlanPhaseOrder = subscriptionUpdateFixedFeeQuantityResponse.activePlanPhaseOrder + adjustmentIntervals = subscriptionUpdateFixedFeeQuantityResponse.adjustmentIntervals + autoCollection = subscriptionUpdateFixedFeeQuantityResponse.autoCollection + billingCycleAnchorConfiguration = + subscriptionUpdateFixedFeeQuantityResponse.billingCycleAnchorConfiguration + billingCycleDay = subscriptionUpdateFixedFeeQuantityResponse.billingCycleDay createdAt = subscriptionUpdateFixedFeeQuantityResponse.createdAt - currentBillingPeriodStartDate = - subscriptionUpdateFixedFeeQuantityResponse.currentBillingPeriodStartDate currentBillingPeriodEndDate = subscriptionUpdateFixedFeeQuantityResponse.currentBillingPeriodEndDate - status = subscriptionUpdateFixedFeeQuantityResponse.status - trialInfo = subscriptionUpdateFixedFeeQuantityResponse.trialInfo - activePlanPhaseOrder = subscriptionUpdateFixedFeeQuantityResponse.activePlanPhaseOrder + currentBillingPeriodStartDate = + subscriptionUpdateFixedFeeQuantityResponse.currentBillingPeriodStartDate + customer = subscriptionUpdateFixedFeeQuantityResponse.customer + defaultInvoiceMemo = subscriptionUpdateFixedFeeQuantityResponse.defaultInvoiceMemo + discountIntervals = subscriptionUpdateFixedFeeQuantityResponse.discountIntervals + endDate = subscriptionUpdateFixedFeeQuantityResponse.endDate fixedFeeQuantitySchedule = subscriptionUpdateFixedFeeQuantityResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionUpdateFixedFeeQuantityResponse.defaultInvoiceMemo - autoCollection = subscriptionUpdateFixedFeeQuantityResponse.autoCollection - netTerms = subscriptionUpdateFixedFeeQuantityResponse.netTerms - redeemedCoupon = subscriptionUpdateFixedFeeQuantityResponse.redeemedCoupon - billingCycleDay = subscriptionUpdateFixedFeeQuantityResponse.billingCycleDay - billingCycleAnchorConfiguration = - subscriptionUpdateFixedFeeQuantityResponse.billingCycleAnchorConfiguration invoicingThreshold = subscriptionUpdateFixedFeeQuantityResponse.invoicingThreshold - priceIntervals = subscriptionUpdateFixedFeeQuantityResponse.priceIntervals - adjustmentIntervals = subscriptionUpdateFixedFeeQuantityResponse.adjustmentIntervals - discountIntervals = subscriptionUpdateFixedFeeQuantityResponse.discountIntervals - minimumIntervals = subscriptionUpdateFixedFeeQuantityResponse.minimumIntervals maximumIntervals = subscriptionUpdateFixedFeeQuantityResponse.maximumIntervals + metadata = subscriptionUpdateFixedFeeQuantityResponse.metadata + minimumIntervals = subscriptionUpdateFixedFeeQuantityResponse.minimumIntervals + netTerms = subscriptionUpdateFixedFeeQuantityResponse.netTerms + plan = subscriptionUpdateFixedFeeQuantityResponse.plan + priceIntervals = subscriptionUpdateFixedFeeQuantityResponse.priceIntervals + redeemedCoupon = subscriptionUpdateFixedFeeQuantityResponse.redeemedCoupon + startDate = subscriptionUpdateFixedFeeQuantityResponse.startDate + status = subscriptionUpdateFixedFeeQuantityResponse.status + trialInfo = subscriptionUpdateFixedFeeQuantityResponse.trialInfo additionalProperties = subscriptionUpdateFixedFeeQuantityResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -538,94 +623,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -634,35 +665,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -679,45 +718,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -728,41 +743,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -785,31 +785,31 @@ private constructor( fun build(): SubscriptionUpdateFixedFeeQuantityResponse = SubscriptionUpdateFixedFeeQuantityResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -822,15 +822,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -839,32 +839,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -875,9 +875,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -893,18 +893,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -918,20 +918,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -942,6 +928,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -965,9 +965,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1221,30 +1221,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1255,22 +1267,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1285,26 +1302,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1314,12 +1314,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1334,23 +1334,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1359,6 +1359,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1383,43 +1414,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1445,12 +1445,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1512,17 +1512,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1532,48 +1532,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1582,32 +1575,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1617,6 +1609,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1626,12 +1626,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1646,24 +1646,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1672,28 +1672,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1705,17 +1688,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1733,6 +1718,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1758,12 +1758,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1825,17 +1825,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1845,21 +1845,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1869,6 +1869,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1879,15 +1885,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1896,6 +1896,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1909,18 +1918,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1936,11 +1936,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1956,22 +1956,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1981,6 +1981,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2005,28 +2021,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2067,11 +2067,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2134,17 +2134,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2154,51 +2154,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2206,35 +2202,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2242,8 +2237,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2254,13 +2254,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2275,25 +2275,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2301,6 +2301,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2316,36 +2332,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2362,11 +2353,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2393,13 +2393,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2461,17 +2461,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2481,56 +2481,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2540,29 +2549,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2572,12 +2572,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2592,23 +2592,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2616,28 +2616,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2649,17 +2632,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2677,6 +2662,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2702,12 +2702,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2769,17 +2769,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2788,17 +2788,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3163,40 +3163,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3205,16 +3196,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3226,6 +3218,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3234,12 +3234,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3253,33 +3253,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3289,20 +3282,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3322,6 +3301,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3346,12 +3346,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3412,57 +3412,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3471,18 +3459,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3494,6 +3481,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3502,12 +3502,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3521,52 +3521,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3575,24 +3573,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3618,12 +3618,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3684,60 +3684,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3746,19 +3731,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3770,6 +3756,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3778,12 +3778,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3797,25 +3797,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3823,6 +3842,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3838,39 +3871,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3895,12 +3895,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3961,17 +3961,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3979,39 +3979,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4020,10 +4020,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4037,39 +4037,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4091,10 +4091,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4104,49 +4104,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4155,6 +4148,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4162,10 +4159,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4177,12 +4171,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4191,11 +4191,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4209,37 +4209,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4259,6 +4245,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4273,6 +4265,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4294,11 +4294,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4308,17 +4308,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4405,32 +4405,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4439,6 +4432,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4446,10 +4443,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4461,12 +4455,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4475,11 +4475,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4493,37 +4493,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4543,6 +4529,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4557,6 +4549,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4578,11 +4578,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4592,17 +4592,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4614,39 +4614,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4655,6 +4672,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4885,51 +4911,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5161,34 +5184,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5199,13 +5199,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5220,26 +5220,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5247,19 +5247,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5273,6 +5302,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5733,64 +5778,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5814,13 +5814,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5829,12 +5829,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5842,16 +5842,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5862,8 +5862,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5878,24 +5878,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5903,6 +5899,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5931,8 +5931,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5943,17 +5943,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5961,17 +5961,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5981,29 +5981,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6013,8 +6013,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6029,15 +6029,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6045,16 +6045,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6077,8 +6077,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6088,17 +6088,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6260,15 +6260,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateFixedFeeQuantityResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateFixedFeeQuantityResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUpdateFixedFeeQuantityResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionUpdateFixedFeeQuantityResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt index 0c7b1984..726c04e8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt @@ -163,33 +163,87 @@ constructor( * charged with the saved payment method on the due date. This property defaults to the * plan's behavior. */ - fun autoCollection(autoCollection: Boolean) = apply { + fun autoCollection(autoCollection: Boolean?) = apply { this.autoCollection = autoCollection } + /** + * Determines whether issued invoices for this subscription will automatically be + * charged with the saved payment method on the due date. This property defaults to the + * plan's behavior. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Determines whether issued invoices for this subscription will automatically be + * charged with the saved payment method on the due date. This property defaults to the + * plan's behavior. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) + /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { this.defaultInvoiceMemo = defaultInvoiceMemo } + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + /** * When this subscription's accrued usage reaches this threshold, an invoice will be * issued for the subscription. If not specified, invoices will only be issued at the * end of the billing period. */ - fun invoicingThreshold(invoicingThreshold: String) = apply { + fun invoicingThreshold(invoicingThreshold: String?) = apply { this.invoicingThreshold = invoicingThreshold } + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be + * issued for the subscription. If not specified, invoices will only be issued at the + * end of the billing period. + */ + fun invoicingThreshold(invoicingThreshold: Optional) = + invoicingThreshold(invoicingThreshold.orElse(null)) + /** * User-specified key/value pairs for the resource. 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) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata?) = apply { this.metadata = metadata } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** + * Determines the difference between the invoice issue date for subscription invoices as + * the date that they are due. A value of `0` here represents that the invoice is due on + * issue, whereas a value of `30` represents that the customer has a month to pay the + * invoice. + */ + fun netTerms(netTerms: Long?) = apply { this.netTerms = netTerms } + + /** + * Determines the difference between the invoice issue date for subscription invoices as + * the date that they are due. A value of `0` here represents that the invoice is due on + * issue, whereas a value of `30` represents that the customer has a month to pay the + * invoice. + */ + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) /** * Determines the difference between the invoice issue date for subscription invoices as @@ -197,7 +251,8 @@ constructor( * issue, whereas a value of `30` represents that the customer has a month to pay the * invoice. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.orElse(null) as Long?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -277,38 +332,91 @@ constructor( * with the saved payment method on the due date. This property defaults to the plan's * behavior. */ - fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } + fun autoCollection(autoCollection: Boolean?) = apply { body.autoCollection(autoCollection) } + + /** + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. + */ + fun autoCollection(autoCollection: Boolean) = autoCollection(autoCollection as Boolean?) + + /** + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun autoCollection(autoCollection: Optional) = + autoCollection(autoCollection.orElse(null) as Boolean?) /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { + fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { body.defaultInvoiceMemo(defaultInvoiceMemo) } + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(defaultInvoiceMemo: Optional) = + defaultInvoiceMemo(defaultInvoiceMemo.orElse(null)) + /** * When this subscription's accrued usage reaches this threshold, an invoice will be issued * for the subscription. If not specified, invoices will only be issued at the end of the * billing period. */ - fun invoicingThreshold(invoicingThreshold: String) = apply { + fun invoicingThreshold(invoicingThreshold: String?) = apply { body.invoicingThreshold(invoicingThreshold) } + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be issued + * for the subscription. If not specified, invoices will only be issued at the end of the + * billing period. + */ + fun invoicingThreshold(invoicingThreshold: Optional) = + invoicingThreshold(invoicingThreshold.orElse(null)) + /** * User-specified key/value pairs for the resource. 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) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** + * User-specified key/value pairs for the resource. 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: Optional) = metadata(metadata.orElse(null)) + + /** + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. + */ + fun netTerms(netTerms: Long?) = apply { body.netTerms(netTerms) } + + /** + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. + */ + fun netTerms(netTerms: Long) = netTerms(netTerms as Long?) /** * Determines the difference between the invoice issue date for subscription invoices as the * date that they are due. A value of `0` here represents that the invoice is due on issue, * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun netTerms(netTerms: Optional) = netTerms(netTerms.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/SubscriptionUpdateTrialParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt index 39ebfa5b..57622f08 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt @@ -138,7 +138,20 @@ constructor( * If true, shifts subsequent price and adjustment intervals (preserving their * durations, but adjusting their absolute dates). */ - fun shift(shift: Boolean) = apply { this.shift = shift } + fun shift(shift: Boolean?) = apply { this.shift = shift } + + /** + * If true, shifts subsequent price and adjustment intervals (preserving their + * durations, but adjusting their absolute dates). + */ + fun shift(shift: Boolean) = shift(shift as Boolean?) + + /** + * If true, shifts subsequent price and adjustment intervals (preserving their + * durations, but adjusting their absolute dates). + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun shift(shift: Optional) = shift(shift.orElse(null) as Boolean?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -229,7 +242,20 @@ constructor( * If true, shifts subsequent price and adjustment intervals (preserving their durations, * but adjusting their absolute dates). */ - fun shift(shift: Boolean) = apply { body.shift(shift) } + fun shift(shift: Boolean?) = apply { body.shift(shift) } + + /** + * If true, shifts subsequent price and adjustment intervals (preserving their durations, + * but adjusting their absolute dates). + */ + fun shift(shift: Boolean) = shift(shift as Boolean?) + + /** + * If true, shifts subsequent price and adjustment intervals (preserving their durations, + * but adjusting their absolute dates). + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun shift(shift: Optional) = shift(shift.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/SubscriptionUpdateTrialResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt index f021a3f3..f842f301 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialResponse.kt @@ -34,90 +34,131 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionUpdateTrialResponse @JsonCreator private constructor( - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("customer") + @JsonProperty("active_plan_phase_order") @ExcludeMissing - private val customer: JsonField = JsonMissing.of(), - @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_intervals") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val adjustmentIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("auto_collection") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + private val billingCycleAnchorConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("billing_cycle_day") + @ExcludeMissing + private val billingCycleDay: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), @JsonProperty("current_billing_period_start_date") @ExcludeMissing private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + @JsonProperty("customer") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), - @JsonProperty("status") + private val customer: JsonField = JsonMissing.of(), + @JsonProperty("default_invoice_memo") @ExcludeMissing - private val status: JsonField = JsonMissing.of(), - @JsonProperty("trial_info") + private val defaultInvoiceMemo: JsonField = JsonMissing.of(), + @JsonProperty("discount_intervals") @ExcludeMissing - private val trialInfo: JsonField = JsonMissing.of(), - @JsonProperty("active_plan_phase_order") + private val discountIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val activePlanPhaseOrder: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing private val fixedFeeQuantitySchedule: JsonField> = JsonMissing.of(), - @JsonProperty("default_invoice_memo") - @ExcludeMissing - private val defaultInvoiceMemo: JsonField = JsonMissing.of(), - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + @JsonProperty("invoicing_threshold") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("redeemed_coupon") + private val invoicingThreshold: JsonField = JsonMissing.of(), + @JsonProperty("maximum_intervals") @ExcludeMissing - private val redeemedCoupon: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val maximumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_anchor_configuration") + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("minimum_intervals") @ExcludeMissing - private val billingCycleAnchorConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("invoicing_threshold") + private val minimumIntervals: JsonField> = JsonMissing.of(), + @JsonProperty("net_terms") @ExcludeMissing - private val invoicingThreshold: JsonField = JsonMissing.of(), + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(), @JsonProperty("price_intervals") @ExcludeMissing private val priceIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("adjustment_intervals") + @JsonProperty("redeemed_coupon") @ExcludeMissing - private val adjustmentIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("discount_intervals") + private val redeemedCoupon: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val discountIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("minimum_intervals") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing - private val minimumIntervals: JsonField> = JsonMissing.of(), - @JsonProperty("maximum_intervals") + private val status: JsonField = JsonMissing.of(), + @JsonProperty("trial_info") @ExcludeMissing - private val maximumIntervals: JsonField> = JsonMissing.of(), + private val trialInfo: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + fun id(): String = id.getRequired("id") + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(): Optional = + Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(): List = + adjustmentIntervals.getRequired("adjustment_intervals") + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. If + * null, defaults to the customer's setting. */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun autoCollection(): Optional = + Optional.ofNullable(autoCollection.getNullable("auto_collection")) - fun id(): String = id.getRequired("id") + fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = + billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of days in + * a month is greater than this value, the last day of the month is the billing cycle day (e.g. + * billing_cycle_day=31 for April means the billing period begins on the 30th. + */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -140,116 +181,116 @@ private constructor( fun customer(): Customer = customer.getRequired("customer") /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun plan(): Plan = plan.getRequired("plan") + fun defaultInvoiceMemo(): Optional = + Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) - /** The date Orb starts billing for this subscription. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The discount intervals for this subscription. */ + fun discountIntervals(): List = + discountIntervals.getRequired("discount_intervals") /** The date Orb stops billing for this subscription. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + fun fixedFeeQuantitySchedule(): List = + fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + + fun invoicingThreshold(): Optional = + Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(): List = + maximumIntervals.getRequired("maximum_intervals") /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. + * 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 currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + fun metadata(): Metadata = metadata.getRequired("metadata") + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(): List = + minimumIntervals.getRequired("minimum_intervals") /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) + fun netTerms(): Long = netTerms.getRequired("net_terms") + + /** + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). + */ + fun plan(): Plan = plan.getRequired("plan") + + /** The price intervals for this subscription. */ + fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") + + fun redeemedCoupon(): Optional = + Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + + /** The date Orb starts billing for this subscription. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") fun status(): Status = status.getRequired("status") fun trialInfo(): TrialInfo = trialInfo.getRequired("trial_info") - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(): Optional = - Optional.ofNullable(activePlanPhaseOrder.getNullable("active_plan_phase_order")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun fixedFeeQuantitySchedule(): List = - fixedFeeQuantitySchedule.getRequired("fixed_fee_quantity_schedule") + /** The current plan phase that is active, only if the subscription's plan has phases. */ + @JsonProperty("active_plan_phase_order") + @ExcludeMissing + fun _activePlanPhaseOrder() = activePlanPhaseOrder - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(): Optional = - Optional.ofNullable(defaultInvoiceMemo.getNullable("default_invoice_memo")) + /** The adjustment intervals for this subscription. */ + @JsonProperty("adjustment_intervals") + @ExcludeMissing + fun _adjustmentIntervals() = adjustmentIntervals /** * Determines whether issued invoices for this subscription will automatically be charged with * the saved payment method on the due date. This property defaults to the plan's behavior. If * null, defaults to the customer's setting. */ - fun autoCollection(): Optional = - Optional.ofNullable(autoCollection.getNullable("auto_collection")) - - /** - * Determines the difference between the invoice issue date for subscription invoices as the - * date that they are due. A value of `0` here represents that the invoice is due on issue, - * whereas a value of `30` represents that the customer has a month to pay the invoice. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + @JsonProperty("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection - fun redeemedCoupon(): Optional = - Optional.ofNullable(redeemedCoupon.getNullable("redeemed_coupon")) + @JsonProperty("billing_cycle_anchor_configuration") + @ExcludeMissing + fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration /** * The day of the month on which the billing cycle is anchored. If the maximum number of days in * a month is greater than this value, the last day of the month is the billing cycle day (e.g. * billing_cycle_day=31 for April means the billing period begins on the 30th. */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - - fun billingCycleAnchorConfiguration(): BillingCycleAnchorConfiguration = - billingCycleAnchorConfiguration.getRequired("billing_cycle_anchor_configuration") + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - fun invoicingThreshold(): Optional = - Optional.ofNullable(invoicingThreshold.getNullable("invoicing_threshold")) + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - /** The price intervals for this subscription. */ - fun priceIntervals(): List = priceIntervals.getRequired("price_intervals") - - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(): List = - adjustmentIntervals.getRequired("adjustment_intervals") - - /** The discount intervals for this subscription. */ - fun discountIntervals(): List = - discountIntervals.getRequired("discount_intervals") - - /** The minimum intervals for this subscription. */ - fun minimumIntervals(): List = - minimumIntervals.getRequired("minimum_intervals") - - /** The maximum intervals for this subscription. */ - fun maximumIntervals(): List = - maximumIntervals.getRequired("maximum_intervals") + /** + * The end of the current billing period. This is an exclusive timestamp, such that the instant + * returned is not part of the billing period. Set to null for subscriptions that are not + * currently active. + */ + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * 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`. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription is + * not currently active. */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -272,65 +313,39 @@ private constructor( @JsonProperty("customer") @ExcludeMissing fun _customer() = customer /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be - * subscribed to by a customer. Plans define the billing behavior of the subscription. You can - * see more about how to configure prices in the [Price resource](/reference/price). + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - @JsonProperty("plan") @ExcludeMissing fun _plan() = plan + @JsonProperty("default_invoice_memo") + @ExcludeMissing + fun _defaultInvoiceMemo() = defaultInvoiceMemo - /** The date Orb starts billing for this subscription. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + /** The discount intervals for this subscription. */ + @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals /** The date Orb stops billing for this subscription. */ @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription is - * not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the instant - * returned is not part of the billing period. Set to null for subscriptions that are not - * currently active. - */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate - - @JsonProperty("status") @ExcludeMissing fun _status() = status - - @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo - - /** The current plan phase that is active, only if the subscription's plan has phases. */ - @JsonProperty("active_plan_phase_order") - @ExcludeMissing - fun _activePlanPhaseOrder() = activePlanPhaseOrder - @JsonProperty("fixed_fee_quantity_schedule") @ExcludeMissing fun _fixedFeeQuantitySchedule() = fixedFeeQuantitySchedule - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - @JsonProperty("default_invoice_memo") + @JsonProperty("invoicing_threshold") @ExcludeMissing - fun _defaultInvoiceMemo() = defaultInvoiceMemo + fun _invoicingThreshold() = invoicingThreshold + + /** The maximum intervals for this subscription. */ + @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals /** - * Determines whether issued invoices for this subscription will automatically be charged with - * the saved payment method on the due date. This property defaults to the plan's behavior. If - * null, defaults to the customer's setting. + * 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("auto_collection") @ExcludeMissing fun _autoCollection() = autoCollection + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** The minimum intervals for this subscription. */ + @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals /** * Determines the difference between the invoice issue date for subscription invoices as the @@ -339,39 +354,24 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms() = netTerms - @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of days in - * a month is greater than this value, the last day of the month is the billing cycle day (e.g. - * billing_cycle_day=31 for April means the billing period begins on the 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be + * subscribed to by a customer. Plans define the billing behavior of the subscription. You can + * see more about how to configure prices in the [Price resource](/reference/price). */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - @JsonProperty("billing_cycle_anchor_configuration") - @ExcludeMissing - fun _billingCycleAnchorConfiguration() = billingCycleAnchorConfiguration - - @JsonProperty("invoicing_threshold") - @ExcludeMissing - fun _invoicingThreshold() = invoicingThreshold + @JsonProperty("plan") @ExcludeMissing fun _plan() = plan /** The price intervals for this subscription. */ @JsonProperty("price_intervals") @ExcludeMissing fun _priceIntervals() = priceIntervals - /** The adjustment intervals for this subscription. */ - @JsonProperty("adjustment_intervals") - @ExcludeMissing - fun _adjustmentIntervals() = adjustmentIntervals + @JsonProperty("redeemed_coupon") @ExcludeMissing fun _redeemedCoupon() = redeemedCoupon - /** The discount intervals for this subscription. */ - @JsonProperty("discount_intervals") @ExcludeMissing fun _discountIntervals() = discountIntervals + /** The date Orb starts billing for this subscription. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - /** The minimum intervals for this subscription. */ - @JsonProperty("minimum_intervals") @ExcludeMissing fun _minimumIntervals() = minimumIntervals + @JsonProperty("status") @ExcludeMissing fun _status() = status - /** The maximum intervals for this subscription. */ - @JsonProperty("maximum_intervals") @ExcludeMissing fun _maximumIntervals() = maximumIntervals + @JsonProperty("trial_info") @ExcludeMissing fun _trialInfo() = trialInfo @JsonAnyGetter @ExcludeMissing @@ -381,31 +381,31 @@ private constructor( fun validate(): SubscriptionUpdateTrialResponse = apply { if (!validated) { - metadata().validate() id() - customer().validate() - plan().validate() - startDate() - endDate() - createdAt() - currentBillingPeriodStartDate() - currentBillingPeriodEndDate() - status() - trialInfo().validate() activePlanPhaseOrder() - fixedFeeQuantitySchedule().forEach { it.validate() } - defaultInvoiceMemo() + adjustmentIntervals().forEach { it.validate() } autoCollection() - netTerms() - redeemedCoupon().map { it.validate() } - billingCycleDay() billingCycleAnchorConfiguration().validate() - invoicingThreshold() - priceIntervals().forEach { it.validate() } - adjustmentIntervals().forEach { it.validate() } + billingCycleDay() + createdAt() + currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + customer().validate() + defaultInvoiceMemo() discountIntervals() - minimumIntervals().forEach { it.validate() } + endDate() + fixedFeeQuantitySchedule().forEach { it.validate() } + invoicingThreshold() maximumIntervals().forEach { it.validate() } + metadata().validate() + minimumIntervals().forEach { it.validate() } + netTerms() + plan().validate() + priceIntervals().forEach { it.validate() } + redeemedCoupon().map { it.validate() } + startDate() + status() + trialInfo().validate() validated = true } } @@ -419,87 +419,172 @@ private constructor( class Builder { - private var metadata: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() - private var customer: JsonField = JsonMissing.of() - private var plan: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var trialInfo: JsonField = JsonMissing.of() private var activePlanPhaseOrder: JsonField = JsonMissing.of() - private var fixedFeeQuantitySchedule: JsonField> = - JsonMissing.of() - private var defaultInvoiceMemo: JsonField = JsonMissing.of() + private var adjustmentIntervals: JsonField> = JsonMissing.of() private var autoCollection: JsonField = JsonMissing.of() - private var netTerms: JsonField = JsonMissing.of() - private var redeemedCoupon: JsonField = JsonMissing.of() - private var billingCycleDay: JsonField = JsonMissing.of() private var billingCycleAnchorConfiguration: JsonField = JsonMissing.of() - private var invoicingThreshold: JsonField = JsonMissing.of() - private var priceIntervals: JsonField> = JsonMissing.of() - private var adjustmentIntervals: JsonField> = JsonMissing.of() + private var billingCycleDay: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var customer: JsonField = JsonMissing.of() + private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var discountIntervals: JsonField> = JsonMissing.of() - private var minimumIntervals: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var fixedFeeQuantitySchedule: JsonField> = + JsonMissing.of() + private var invoicingThreshold: JsonField = JsonMissing.of() private var maximumIntervals: JsonField> = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var minimumIntervals: JsonField> = JsonMissing.of() + private var netTerms: JsonField = JsonMissing.of() + private var plan: JsonField = JsonMissing.of() + private var priceIntervals: JsonField> = JsonMissing.of() + private var redeemedCoupon: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var trialInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionUpdateTrialResponse: SubscriptionUpdateTrialResponse) = apply { - metadata = subscriptionUpdateTrialResponse.metadata id = subscriptionUpdateTrialResponse.id - customer = subscriptionUpdateTrialResponse.customer - plan = subscriptionUpdateTrialResponse.plan - startDate = subscriptionUpdateTrialResponse.startDate - endDate = subscriptionUpdateTrialResponse.endDate - createdAt = subscriptionUpdateTrialResponse.createdAt - currentBillingPeriodStartDate = - subscriptionUpdateTrialResponse.currentBillingPeriodStartDate - currentBillingPeriodEndDate = - subscriptionUpdateTrialResponse.currentBillingPeriodEndDate - status = subscriptionUpdateTrialResponse.status - trialInfo = subscriptionUpdateTrialResponse.trialInfo activePlanPhaseOrder = subscriptionUpdateTrialResponse.activePlanPhaseOrder - fixedFeeQuantitySchedule = subscriptionUpdateTrialResponse.fixedFeeQuantitySchedule - defaultInvoiceMemo = subscriptionUpdateTrialResponse.defaultInvoiceMemo + adjustmentIntervals = subscriptionUpdateTrialResponse.adjustmentIntervals autoCollection = subscriptionUpdateTrialResponse.autoCollection - netTerms = subscriptionUpdateTrialResponse.netTerms - redeemedCoupon = subscriptionUpdateTrialResponse.redeemedCoupon - billingCycleDay = subscriptionUpdateTrialResponse.billingCycleDay billingCycleAnchorConfiguration = subscriptionUpdateTrialResponse.billingCycleAnchorConfiguration - invoicingThreshold = subscriptionUpdateTrialResponse.invoicingThreshold - priceIntervals = subscriptionUpdateTrialResponse.priceIntervals - adjustmentIntervals = subscriptionUpdateTrialResponse.adjustmentIntervals + billingCycleDay = subscriptionUpdateTrialResponse.billingCycleDay + createdAt = subscriptionUpdateTrialResponse.createdAt + currentBillingPeriodEndDate = + subscriptionUpdateTrialResponse.currentBillingPeriodEndDate + currentBillingPeriodStartDate = + subscriptionUpdateTrialResponse.currentBillingPeriodStartDate + customer = subscriptionUpdateTrialResponse.customer + defaultInvoiceMemo = subscriptionUpdateTrialResponse.defaultInvoiceMemo discountIntervals = subscriptionUpdateTrialResponse.discountIntervals - minimumIntervals = subscriptionUpdateTrialResponse.minimumIntervals + endDate = subscriptionUpdateTrialResponse.endDate + fixedFeeQuantitySchedule = subscriptionUpdateTrialResponse.fixedFeeQuantitySchedule + invoicingThreshold = subscriptionUpdateTrialResponse.invoicingThreshold maximumIntervals = subscriptionUpdateTrialResponse.maximumIntervals + metadata = subscriptionUpdateTrialResponse.metadata + minimumIntervals = subscriptionUpdateTrialResponse.minimumIntervals + netTerms = subscriptionUpdateTrialResponse.netTerms + plan = subscriptionUpdateTrialResponse.plan + priceIntervals = subscriptionUpdateTrialResponse.priceIntervals + redeemedCoupon = subscriptionUpdateTrialResponse.redeemedCoupon + startDate = subscriptionUpdateTrialResponse.startDate + status = subscriptionUpdateTrialResponse.status + trialInfo = subscriptionUpdateTrialResponse.trialInfo additionalProperties = subscriptionUpdateTrialResponse.additionalProperties.toMutableMap() } + fun id(id: String) = id(JsonField.of(id)) + + fun id(id: JsonField) = apply { this.id = id } + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = + activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + + /** The current plan phase that is active, only if the subscription's plan has phases. */ + fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { + this.activePlanPhaseOrder = activePlanPhaseOrder + } + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: List) = + adjustmentIntervals(JsonField.of(adjustmentIntervals)) + + /** The adjustment intervals for this subscription. */ + fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { + this.adjustmentIntervals = adjustmentIntervals + } + /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) /** - * 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`. + * Determines whether issued invoices for this subscription will automatically be charged + * with the saved payment method on the due date. This property defaults to the plan's + * behavior. If null, defaults to the customer's setting. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - fun id(id: String) = id(JsonField.of(id)) + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration + ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - fun id(id: JsonField) = apply { this.id = id } + fun billingCycleAnchorConfiguration( + billingCycleAnchorConfiguration: JsonField + ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + + /** + * The day of the month on which the billing cycle is anchored. If the maximum number of + * days in a month is greater than this value, the last day of the month is the billing + * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the + * 30th. + */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + + /** + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is not part of the billing period. Set to null for subscriptions that + * are not currently active. + */ + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = + apply { + this.currentBillingPeriodEndDate = currentBillingPeriodEndDate + } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if the subscription + * is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * A customer is a buyer of your products, and the other party to the billing relationship. @@ -536,94 +621,40 @@ private constructor( * * A customer also has a timezone (from the standard * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your - * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) - * for information on what this timezone parameter influences within Orb. - */ - fun customer(customer: JsonField) = apply { this.customer = customer } - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: Plan) = plan(JsonField.of(plan)) - - /** - * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that - * can be subscribed to by a customer. Plans define the billing behavior of the - * subscription. You can see more about how to configure prices in the - * [Price resource](/reference/price). - */ - fun plan(plan: JsonField) = apply { this.plan = plan } - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The date Orb starts billing for this subscription. */ - fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The date Orb stops billing for this subscription. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if the subscription - * is not currently active. + * account's timezone. See [Timezone localization](../guides/product-catalog/timezones.md) + * for information on what this timezone parameter influences within Orb. */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } + fun customer(customer: JsonField) = apply { this.customer = customer } /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun defaultInvoiceMemo(defaultInvoiceMemo: String) = + defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is not part of the billing period. Set to null for subscriptions that - * are not currently active. + * Determines the default memo on this subscriptions' invoices. Note that if this is not + * provided, it is determined by the plan configuration. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: JsonField) = - apply { - this.currentBillingPeriodEndDate = currentBillingPeriodEndDate - } - - fun status(status: Status) = status(JsonField.of(status)) - - fun status(status: JsonField) = apply { this.status = status } + fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { + this.defaultInvoiceMemo = defaultInvoiceMemo + } - fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: List) = + discountIntervals(JsonField.of(discountIntervals)) - fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } + /** The discount intervals for this subscription. */ + fun discountIntervals(discountIntervals: JsonField>) = apply { + this.discountIntervals = discountIntervals + } - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: Long) = - activePlanPhaseOrder(JsonField.of(activePlanPhaseOrder)) + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - /** The current plan phase that is active, only if the subscription's plan has phases. */ - fun activePlanPhaseOrder(activePlanPhaseOrder: JsonField) = apply { - this.activePlanPhaseOrder = activePlanPhaseOrder - } + /** The date Orb stops billing for this subscription. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } fun fixedFeeQuantitySchedule(fixedFeeQuantitySchedule: List) = fixedFeeQuantitySchedule(JsonField.of(fixedFeeQuantitySchedule)) @@ -632,35 +663,43 @@ private constructor( fixedFeeQuantitySchedule: JsonField> ) = apply { this.fixedFeeQuantitySchedule = fixedFeeQuantitySchedule } - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: String) = - defaultInvoiceMemo(JsonField.of(defaultInvoiceMemo)) + fun invoicingThreshold(invoicingThreshold: String) = + invoicingThreshold(JsonField.of(invoicingThreshold)) - /** - * Determines the default memo on this subscriptions' invoices. Note that if this is not - * provided, it is determined by the plan configuration. - */ - fun defaultInvoiceMemo(defaultInvoiceMemo: JsonField) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + fun invoicingThreshold(invoicingThreshold: JsonField) = apply { + this.invoicingThreshold = invoicingThreshold + } + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: List) = + maximumIntervals(JsonField.of(maximumIntervals)) + + /** The maximum intervals for this subscription. */ + fun maximumIntervals(maximumIntervals: JsonField>) = apply { + this.maximumIntervals = maximumIntervals } /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: Boolean) = autoCollection(JsonField.of(autoCollection)) + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) /** - * Determines whether issued invoices for this subscription will automatically be charged - * with the saved payment method on the due date. This property defaults to the plan's - * behavior. If null, defaults to the customer's setting. + * 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 autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: List) = + minimumIntervals(JsonField.of(minimumIntervals)) + + /** The minimum intervals for this subscription. */ + fun minimumIntervals(minimumIntervals: JsonField>) = apply { + this.minimumIntervals = minimumIntervals } /** @@ -677,45 +716,21 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = - redeemedCoupon(JsonField.of(redeemedCoupon)) - - fun redeemedCoupon(redeemedCoupon: JsonField) = apply { - this.redeemedCoupon = redeemedCoupon - } - /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: Long) = billingCycleDay(JsonField.of(billingCycleDay)) + fun plan(plan: Plan) = plan(JsonField.of(plan)) /** - * The day of the month on which the billing cycle is anchored. If the maximum number of - * days in a month is greater than this value, the last day of the month is the billing - * cycle day (e.g. billing_cycle_day=31 for April means the billing period begins on the - * 30th. + * The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that + * can be subscribed to by a customer. Plans define the billing behavior of the + * subscription. You can see more about how to configure prices in the + * [Price resource](/reference/price). */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = billingCycleAnchorConfiguration(JsonField.of(billingCycleAnchorConfiguration)) - - fun billingCycleAnchorConfiguration( - billingCycleAnchorConfiguration: JsonField - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } - - fun invoicingThreshold(invoicingThreshold: String) = - invoicingThreshold(JsonField.of(invoicingThreshold)) - - fun invoicingThreshold(invoicingThreshold: JsonField) = apply { - this.invoicingThreshold = invoicingThreshold - } + fun plan(plan: JsonField) = apply { this.plan = plan } /** The price intervals for this subscription. */ fun priceIntervals(priceIntervals: List) = @@ -726,41 +741,26 @@ private constructor( this.priceIntervals = priceIntervals } - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: List) = - adjustmentIntervals(JsonField.of(adjustmentIntervals)) + fun redeemedCoupon(redeemedCoupon: RedeemedCoupon) = + redeemedCoupon(JsonField.of(redeemedCoupon)) - /** The adjustment intervals for this subscription. */ - fun adjustmentIntervals(adjustmentIntervals: JsonField>) = apply { - this.adjustmentIntervals = adjustmentIntervals + fun redeemedCoupon(redeemedCoupon: JsonField) = apply { + this.redeemedCoupon = redeemedCoupon } - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: List) = - discountIntervals(JsonField.of(discountIntervals)) + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The discount intervals for this subscription. */ - fun discountIntervals(discountIntervals: JsonField>) = apply { - this.discountIntervals = discountIntervals - } + /** The date Orb starts billing for this subscription. */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: List) = - minimumIntervals(JsonField.of(minimumIntervals)) + fun status(status: Status) = status(JsonField.of(status)) - /** The minimum intervals for this subscription. */ - fun minimumIntervals(minimumIntervals: JsonField>) = apply { - this.minimumIntervals = minimumIntervals - } + fun status(status: JsonField) = apply { this.status = status } - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: List) = - maximumIntervals(JsonField.of(maximumIntervals)) + fun trialInfo(trialInfo: TrialInfo) = trialInfo(JsonField.of(trialInfo)) - /** The maximum intervals for this subscription. */ - fun maximumIntervals(maximumIntervals: JsonField>) = apply { - this.maximumIntervals = maximumIntervals - } + fun trialInfo(trialInfo: JsonField) = apply { this.trialInfo = trialInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -783,31 +783,31 @@ private constructor( fun build(): SubscriptionUpdateTrialResponse = SubscriptionUpdateTrialResponse( - metadata, id, - customer, - plan, - startDate, - endDate, - createdAt, - currentBillingPeriodStartDate, - currentBillingPeriodEndDate, - status, - trialInfo, activePlanPhaseOrder, - fixedFeeQuantitySchedule.map { it.toImmutable() }, - defaultInvoiceMemo, + adjustmentIntervals.map { it.toImmutable() }, autoCollection, - netTerms, - redeemedCoupon, - billingCycleDay, billingCycleAnchorConfiguration, - invoicingThreshold, - priceIntervals.map { it.toImmutable() }, - adjustmentIntervals.map { it.toImmutable() }, + billingCycleDay, + createdAt, + currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + customer, + defaultInvoiceMemo, discountIntervals.map { it.toImmutable() }, - minimumIntervals.map { it.toImmutable() }, + endDate, + fixedFeeQuantitySchedule.map { it.toImmutable() }, + invoicingThreshold, maximumIntervals.map { it.toImmutable() }, + metadata, + minimumIntervals.map { it.toImmutable() }, + netTerms, + plan, + priceIntervals.map { it.toImmutable() }, + redeemedCoupon, + startDate, + status, + trialInfo, additionalProperties.toImmutable(), ) } @@ -820,15 +820,15 @@ private constructor( @JsonProperty("adjustment") @ExcludeMissing private val adjustment: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { @@ -837,32 +837,32 @@ private constructor( fun adjustment(): Adjustment = adjustment.getRequired("adjustment") - /** The start date of the adjustment interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + /** The price interval IDs that this adjustment applies to. */ + fun appliesToPriceIntervalIds(): List = + appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") /** The end date of the adjustment interval. */ fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - /** The price interval IDs that this adjustment applies to. */ - fun appliesToPriceIntervalIds(): List = - appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The start date of the adjustment interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("adjustment") @ExcludeMissing fun _adjustment() = adjustment - /** The start date of the adjustment interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the adjustment interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - /** The price interval IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the adjustment interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the adjustment interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -873,9 +873,9 @@ private constructor( if (!validated) { id() adjustment() - startDate() - endDate() appliesToPriceIntervalIds() + endDate() + startDate() validated = true } } @@ -891,18 +891,18 @@ private constructor( private var id: JsonField = JsonMissing.of() private var adjustment: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(adjustmentInterval: AdjustmentInterval) = apply { id = adjustmentInterval.id adjustment = adjustmentInterval.adjustment - startDate = adjustmentInterval.startDate - endDate = adjustmentInterval.endDate appliesToPriceIntervalIds = adjustmentInterval.appliesToPriceIntervalIds + endDate = adjustmentInterval.endDate + startDate = adjustmentInterval.startDate additionalProperties = adjustmentInterval.additionalProperties.toMutableMap() } @@ -916,20 +916,6 @@ private constructor( this.adjustment = adjustment } - /** The start date of the adjustment interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the adjustment interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the adjustment interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the adjustment interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price interval IDs that this adjustment applies to. */ fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) @@ -940,6 +926,20 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the adjustment interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the adjustment interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the adjustment interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the adjustment interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -963,9 +963,9 @@ private constructor( AdjustmentInterval( id, adjustment, - startDate, - endDate, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -1219,30 +1219,42 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("amount_discount") + @ExcludeMissing + private val amountDiscount: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("amount_discount") - @ExcludeMissing - private val amountDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** + * The amount by which to discount the prices this adjustment applies to in a given + * billing period. + */ + fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1253,22 +1265,27 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType /** * The amount by which to discount the prices this adjustment applies to in a given * billing period. */ - fun amountDiscount(): String = amountDiscount.getRequired("amount_discount") + @JsonProperty("amount_discount") + @ExcludeMissing + fun _amountDiscount() = amountDiscount - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -1283,26 +1300,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The amount by which to discount the prices this adjustment applies to in a given - * billing period. - */ - @JsonProperty("amount_discount") - @ExcludeMissing - fun _amountDiscount() = amountDiscount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1312,12 +1312,12 @@ private constructor( fun validate(): AmountDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + amountDiscount() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - amountDiscount() validated = true } } @@ -1332,23 +1332,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var amountDiscount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var amountDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply { id = amountDiscountAdjustment.id + adjustmentType = amountDiscountAdjustment.adjustmentType + amountDiscount = amountDiscountAdjustment.amountDiscount + appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel planPhaseOrder = amountDiscountAdjustment.planPhaseOrder - appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds reason = amountDiscountAdjustment.reason - adjustmentType = amountDiscountAdjustment.adjustmentType - amountDiscount = amountDiscountAdjustment.amountDiscount additionalProperties = amountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1357,6 +1357,37 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: String) = + amountDiscount(JsonField.of(amountDiscount)) + + /** + * The amount by which to discount the prices this adjustment applies to in a + * given billing period. + */ + fun amountDiscount(amountDiscount: JsonField) = apply { + this.amountDiscount = amountDiscount + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -1381,43 +1412,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: String) = - amountDiscount(JsonField.of(amountDiscount)) - - /** - * The amount by which to discount the prices this adjustment applies to in a - * given billing period. - */ - fun amountDiscount(amountDiscount: JsonField) = apply { - this.amountDiscount = amountDiscount - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1443,12 +1443,12 @@ private constructor( fun build(): AmountDiscountAdjustment = AmountDiscountAdjustment( id, + adjustmentType, + amountDiscount, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - amountDiscount, additionalProperties.toImmutable(), ) } @@ -1510,17 +1510,17 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}" + "AmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1530,48 +1530,41 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("percentage_discount") + @ExcludeMissing + private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("percentage_discount") - @ExcludeMissing - private val percentageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1580,32 +1573,31 @@ private constructor( fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel /** * The percentage (as a value between 0 and 1) by which to discount the price @@ -1615,6 +1607,14 @@ private constructor( @ExcludeMissing fun _percentageDiscount() = percentageDiscount + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1624,12 +1624,12 @@ private constructor( fun validate(): PercentageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + percentageDiscount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - percentageDiscount() validated = true } } @@ -1644,24 +1644,24 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var percentageDiscount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var percentageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) = apply { id = percentageDiscountAdjustment.id + adjustmentType = percentageDiscountAdjustment.adjustmentType + appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel + percentageDiscount = percentageDiscountAdjustment.percentageDiscount planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds reason = percentageDiscountAdjustment.reason - adjustmentType = percentageDiscountAdjustment.adjustmentType - percentageDiscount = percentageDiscountAdjustment.percentageDiscount additionalProperties = percentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -1670,28 +1670,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -1703,17 +1686,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -1731,6 +1716,21 @@ private constructor( this.percentageDiscount = percentageDiscount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1756,12 +1756,12 @@ private constructor( fun build(): PercentageDiscountAdjustment = PercentageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + percentageDiscount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - percentageDiscount, additionalProperties.toImmutable(), ) } @@ -1823,17 +1823,17 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}" + "PercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1843,21 +1843,21 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing private val usageDiscount: JsonField = JsonMissing.of(), @@ -1867,6 +1867,12 @@ private constructor( fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1877,15 +1883,9 @@ private constructor( fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1894,6 +1894,15 @@ private constructor( @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType + + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. @@ -1907,18 +1916,9 @@ private constructor( @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - /** * The number of usage units by which to discount the price this adjustment applies * to in a given billing period. @@ -1934,11 +1934,11 @@ private constructor( fun validate(): UsageDiscountAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() usageDiscount() validated = true } @@ -1954,22 +1954,22 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply { id = usageDiscountAdjustment.id + adjustmentType = usageDiscountAdjustment.adjustmentType + appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel planPhaseOrder = usageDiscountAdjustment.planPhaseOrder - appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds reason = usageDiscountAdjustment.reason - adjustmentType = usageDiscountAdjustment.adjustmentType usageDiscount = usageDiscountAdjustment.usageDiscount additionalProperties = usageDiscountAdjustment.additionalProperties.toMutableMap() @@ -1979,6 +1979,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2003,28 +2019,12 @@ private constructor( this.planPhaseOrder = planPhaseOrder } - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - /** The reason for the adjustment. */ fun reason(reason: String) = reason(JsonField.of(reason)) /** The reason for the adjustment. */ fun reason(reason: JsonField) = apply { this.reason = reason } - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) - - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } - /** * The number of usage units by which to discount the price this adjustment * applies to in a given billing period. @@ -2065,11 +2065,11 @@ private constructor( fun build(): UsageDiscountAdjustment = UsageDiscountAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, usageDiscount, additionalProperties.toImmutable(), ) @@ -2132,17 +2132,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "UsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2152,51 +2152,47 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("is_invoice_level") - @ExcludeMissing - private val isInvoiceLevel: JsonField = JsonMissing.of(), - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - private val planPhaseOrder: JsonField = JsonMissing.of(), + private val adjustmentType: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("reason") + @JsonProperty("is_invoice_level") @ExcludeMissing - private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") + private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), + private val itemId: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("item_id") + @JsonProperty("plan_phase_order") @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), + private val planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + private val reason: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(): Optional = - Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") /** The price IDs that this adjustment applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ - fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(): String = itemId.getRequired("item_id") /** * The minimum amount to charge in a given billing period for the prices this @@ -2204,35 +2200,34 @@ private constructor( */ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The reason for the adjustment. */ + fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - /** - * True for adjustments that apply to an entire invocice, false for adjustments that - * apply to only one price. - */ - @JsonProperty("is_invoice_level") - @ExcludeMissing - fun _isInvoiceLevel() = isInvoiceLevel + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The plan phase in which this adjustment is active. */ - @JsonProperty("plan_phase_order") + @JsonProperty("adjustment_type") @ExcludeMissing - fun _planPhaseOrder() = planPhaseOrder + fun _adjustmentType() = adjustmentType /** The price IDs that this adjustment applies to. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ - @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - - @JsonProperty("adjustment_type") + /** + * True for adjustments that apply to an entire invocice, false for adjustments that + * apply to only one price. + */ + @JsonProperty("is_invoice_level") @ExcludeMissing - fun _adjustmentType() = adjustmentType + fun _isInvoiceLevel() = isInvoiceLevel + + /** The item ID that revenue from this minimum will be attributed to. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId /** * The minimum amount to charge in a given billing period for the prices this @@ -2240,8 +2235,13 @@ private constructor( */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** The item ID that revenue from this minimum will be attributed to. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + /** The plan phase in which this adjustment is active. */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder() = planPhaseOrder + + /** The reason for the adjustment. */ + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason @JsonAnyGetter @ExcludeMissing @@ -2252,13 +2252,13 @@ private constructor( fun validate(): MinimumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + itemId() + minimumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - minimumAmount() - itemId() validated = true } } @@ -2273,25 +2273,25 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var minimumAmount: JsonField = JsonMissing.of() - private var itemId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumAdjustment: MinimumAdjustment) = apply { id = minimumAdjustment.id + adjustmentType = minimumAdjustment.adjustmentType + appliesToPriceIds = minimumAdjustment.appliesToPriceIds isInvoiceLevel = minimumAdjustment.isInvoiceLevel + itemId = minimumAdjustment.itemId + minimumAmount = minimumAdjustment.minimumAmount planPhaseOrder = minimumAdjustment.planPhaseOrder - appliesToPriceIds = minimumAdjustment.appliesToPriceIds reason = minimumAdjustment.reason - adjustmentType = minimumAdjustment.adjustmentType - minimumAmount = minimumAdjustment.minimumAmount - itemId = minimumAdjustment.itemId additionalProperties = minimumAdjustment.additionalProperties.toMutableMap() } @@ -2299,6 +2299,22 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) + + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType + } + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + /** * True for adjustments that apply to an entire invocice, false for adjustments * that apply to only one price. @@ -2314,36 +2330,11 @@ private constructor( this.isInvoiceLevel = isInvoiceLevel } - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder - } - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType - } + /** The item ID that revenue from this minimum will be attributed to. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } /** * The minimum amount to charge in a given billing period for the prices this @@ -2360,11 +2351,20 @@ private constructor( this.minimumAmount = minimumAmount } - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) - /** The item ID that revenue from this minimum will be attributed to. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2391,13 +2391,13 @@ private constructor( fun build(): MinimumAdjustment = MinimumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + itemId, + minimumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - minimumAmount, - itemId, additionalProperties.toImmutable(), ) } @@ -2459,17 +2459,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}" + "MinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -2479,56 +2479,65 @@ private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("adjustment_type") + @ExcludeMissing + private val adjustmentType: JsonField = JsonMissing.of(), + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("is_invoice_level") @ExcludeMissing private val isInvoiceLevel: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("plan_phase_order") @ExcludeMissing private val planPhaseOrder: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing private val reason: JsonField = JsonMissing.of(), - @JsonProperty("adjustment_type") - @ExcludeMissing - private val adjustmentType: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + + /** The price IDs that this adjustment applies to. */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + /** * True for adjustments that apply to an entire invocice, false for adjustments that * apply to only one price. */ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level") + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** The plan phase in which this adjustment is active. */ fun planPhaseOrder(): Optional = Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) - /** The price IDs that this adjustment applies to. */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") - /** The reason for the adjustment. */ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason")) - fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type") + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + @JsonProperty("adjustment_type") + @ExcludeMissing + fun _adjustmentType() = adjustmentType - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The price IDs that this adjustment applies to. */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds /** * True for adjustments that apply to an entire invocice, false for adjustments that @@ -2538,29 +2547,20 @@ private constructor( @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel + /** + * The maximum amount to charge in a given billing period for the prices this + * adjustment applies to. + */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The plan phase in which this adjustment is active. */ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder - /** The price IDs that this adjustment applies to. */ - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds - /** The reason for the adjustment. */ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason - @JsonProperty("adjustment_type") - @ExcludeMissing - fun _adjustmentType() = adjustmentType - - /** - * The maximum amount to charge in a given billing period for the prices this - * adjustment applies to. - */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -2570,12 +2570,12 @@ private constructor( fun validate(): MaximumAdjustment = apply { if (!validated) { id() + adjustmentType() + appliesToPriceIds() isInvoiceLevel() + maximumAmount() planPhaseOrder() - appliesToPriceIds() reason() - adjustmentType() - maximumAmount() validated = true } } @@ -2590,23 +2590,23 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var adjustmentType: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var isInvoiceLevel: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var planPhaseOrder: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() private var reason: JsonField = JsonMissing.of() - private var adjustmentType: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumAdjustment: MaximumAdjustment) = apply { id = maximumAdjustment.id + adjustmentType = maximumAdjustment.adjustmentType + appliesToPriceIds = maximumAdjustment.appliesToPriceIds isInvoiceLevel = maximumAdjustment.isInvoiceLevel + maximumAmount = maximumAdjustment.maximumAmount planPhaseOrder = maximumAdjustment.planPhaseOrder - appliesToPriceIds = maximumAdjustment.appliesToPriceIds reason = maximumAdjustment.reason - adjustmentType = maximumAdjustment.adjustmentType - maximumAmount = maximumAdjustment.maximumAmount additionalProperties = maximumAdjustment.additionalProperties.toMutableMap() } @@ -2614,28 +2614,11 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: Boolean) = - isInvoiceLevel(JsonField.of(isInvoiceLevel)) - - /** - * True for adjustments that apply to an entire invocice, false for adjustments - * that apply to only one price. - */ - fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { - this.isInvoiceLevel = isInvoiceLevel - } - - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: Long) = - planPhaseOrder(JsonField.of(planPhaseOrder)) + fun adjustmentType(adjustmentType: AdjustmentType) = + adjustmentType(JsonField.of(adjustmentType)) - /** The plan phase in which this adjustment is active. */ - fun planPhaseOrder(planPhaseOrder: JsonField) = apply { - this.planPhaseOrder = planPhaseOrder + fun adjustmentType(adjustmentType: JsonField) = apply { + this.adjustmentType = adjustmentType } /** The price IDs that this adjustment applies to. */ @@ -2647,17 +2630,19 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } - /** The reason for the adjustment. */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** The reason for the adjustment. */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun adjustmentType(adjustmentType: AdjustmentType) = - adjustmentType(JsonField.of(adjustmentType)) + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: Boolean) = + isInvoiceLevel(JsonField.of(isInvoiceLevel)) - fun adjustmentType(adjustmentType: JsonField) = apply { - this.adjustmentType = adjustmentType + /** + * True for adjustments that apply to an entire invocice, false for adjustments + * that apply to only one price. + */ + fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply { + this.isInvoiceLevel = isInvoiceLevel } /** @@ -2675,6 +2660,21 @@ private constructor( this.maximumAmount = maximumAmount } + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: Long) = + planPhaseOrder(JsonField.of(planPhaseOrder)) + + /** The plan phase in which this adjustment is active. */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + /** The reason for the adjustment. */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** The reason for the adjustment. */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2700,12 +2700,12 @@ private constructor( fun build(): MaximumAdjustment = MaximumAdjustment( id, + adjustmentType, + appliesToPriceIds.map { it.toImmutable() }, isInvoiceLevel, + maximumAmount, planPhaseOrder, - appliesToPriceIds.map { it.toImmutable() }, reason, - adjustmentType, - maximumAmount, additionalProperties.toImmutable(), ) } @@ -2767,17 +2767,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" } } @@ -2786,17 +2786,17 @@ private constructor( return true } - return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && startDate == other.startDate && endDate == other.endDate && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AdjustmentInterval && id == other.id && adjustment == other.adjustment && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustment, startDate, endDate, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustment, appliesToPriceIntervalIds, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AdjustmentInterval{id=$id, adjustment=$adjustment, startDate=$startDate, endDate=$endDate, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AdjustmentInterval{id=$id, adjustment=$adjustment, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -3161,40 +3161,31 @@ private constructor( class AmountDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), @JsonProperty("amount_discount") @ExcludeMissing private val amountDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") + @ExcludeMissing + private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: 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") - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3203,16 +3194,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** Only available if discount_type is `amount`. */ - @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** Only available if discount_type is `amount`. */ + @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3224,6 +3216,14 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3232,12 +3232,12 @@ private constructor( fun validate(): AmountDiscountInterval = apply { if (!validated) { - discountType() amountDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() validated = true } } @@ -3251,33 +3251,26 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var amountDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(amountDiscountInterval: AmountDiscountInterval) = apply { - discountType = amountDiscountInterval.discountType amountDiscount = amountDiscountInterval.amountDiscount - startDate = amountDiscountInterval.startDate - endDate = amountDiscountInterval.endDate appliesToPriceIds = amountDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = amountDiscountInterval.appliesToPriceIntervalIds + discountType = amountDiscountInterval.discountType + endDate = amountDiscountInterval.endDate + startDate = amountDiscountInterval.startDate additionalProperties = amountDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** Only available if discount_type is `amount`. */ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount)) @@ -3287,20 +3280,6 @@ private constructor( this.amountDiscount = amountDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -3320,6 +3299,27 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3344,12 +3344,12 @@ private constructor( fun build(): AmountDiscountInterval = AmountDiscountInterval( - discountType, amountDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -3410,57 +3410,45 @@ private constructor( return true } - return /* spotless:off */ other is AmountDiscountInterval && discountType == other.discountType && amountDiscount == other.amountDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AmountDiscountInterval && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AmountDiscountInterval{discountType=$discountType, amountDiscount=$amountDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "AmountDiscountInterval{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class PercentageDiscountInterval @JsonCreator private constructor( + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") + @ExcludeMissing + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonProperty("discount_type") @ExcludeMissing private val discountType: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("percentage_discount") @ExcludeMissing private val percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("start_date") @ExcludeMissing private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") - @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") - @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3469,18 +3457,17 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ - @JsonProperty("percentage_discount") - @ExcludeMissing - fun _percentageDiscount() = percentageDiscount + fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount") /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3492,6 +3479,19 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** Only available if discount_type is `percentage`.This is a number between 0 and 1. */ + @JsonProperty("percentage_discount") + @ExcludeMissing + fun _percentageDiscount() = percentageDiscount + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3500,12 +3500,12 @@ private constructor( fun validate(): PercentageDiscountInterval = apply { if (!validated) { + appliesToPriceIds() + appliesToPriceIntervalIds() discountType() + endDate() percentageDiscount() startDate() - endDate() - appliesToPriceIds() - appliesToPriceIntervalIds() validated = true } } @@ -3519,52 +3519,50 @@ private constructor( class Builder { + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var percentageDiscount: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() - private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(percentageDiscountInterval: PercentageDiscountInterval) = apply { + appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds + appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds discountType = percentageDiscountInterval.discountType + endDate = percentageDiscountInterval.endDate percentageDiscount = percentageDiscountInterval.percentageDiscount startDate = percentageDiscountInterval.startDate - endDate = percentageDiscountInterval.endDate - appliesToPriceIds = percentageDiscountInterval.appliesToPriceIds - appliesToPriceIntervalIds = percentageDiscountInterval.appliesToPriceIntervalIds additionalProperties = percentageDiscountInterval.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = - discountType(JsonField.of(discountType)) + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: Double) = - percentageDiscount(JsonField.of(percentageDiscount)) + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - /** - * Only available if discount_type is `percentage`.This is a number between 0 and 1. - */ - fun percentageDiscount(percentageDiscount: JsonField) = apply { - this.percentageDiscount = percentageDiscount - } + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun discountType(discountType: DiscountType) = + discountType(JsonField.of(discountType)) - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType } /** The end date of the discount interval. */ @@ -3573,24 +3571,26 @@ private constructor( /** The end date of the discount interval. */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: Double) = + percentageDiscount(JsonField.of(percentageDiscount)) + + /** + * Only available if discount_type is `percentage`.This is a number between 0 and 1. + */ + fun percentageDiscount(percentageDiscount: JsonField) = apply { + this.percentageDiscount = percentageDiscount } - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3616,12 +3616,12 @@ private constructor( fun build(): PercentageDiscountInterval = PercentageDiscountInterval( + appliesToPriceIds.map { it.toImmutable() }, + appliesToPriceIntervalIds.map { it.toImmutable() }, discountType, + endDate, percentageDiscount, startDate, - endDate, - appliesToPriceIds.map { it.toImmutable() }, - appliesToPriceIntervalIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -3682,60 +3682,45 @@ private constructor( return true } - return /* spotless:off */ other is PercentageDiscountInterval && discountType == other.discountType && percentageDiscount == other.percentageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PercentageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && percentageDiscount == other.percentageDiscount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, percentageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, percentageDiscount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PercentageDiscountInterval{discountType=$discountType, percentageDiscount=$percentageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "PercentageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, percentageDiscount=$percentageDiscount, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class UsageDiscountInterval @JsonCreator private constructor( - @JsonProperty("discount_type") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - private val discountType: JsonField = JsonMissing.of(), - @JsonProperty("usage_discount") + private val appliesToPriceIds: JsonField> = JsonMissing.of(), + @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing - private val usageDiscount: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("discount_type") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), + private val discountType: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("applies_to_price_ids") + @JsonProperty("start_date") @ExcludeMissing - private val appliesToPriceIds: JsonField> = JsonMissing.of(), - @JsonProperty("applies_to_price_interval_ids") + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("usage_discount") @ExcludeMissing - private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + private val usageDiscount: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - - /** - * Only available if discount_type is `usage`. Number of usage units that this discount - * is for - */ - fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") - - /** The start date of the discount interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the discount interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this discount interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -3744,19 +3729,20 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + fun discountType(): DiscountType = discountType.getRequired("discount_type") + + /** The end date of the discount interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + /** The start date of the discount interval. */ + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** * Only available if discount_type is `usage`. Number of usage units that this discount * is for */ - @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount - - /** The start date of the discount interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the discount interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount") /** The price ids that this discount interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -3768,6 +3754,20 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + + /** The end date of the discount interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** The start date of the discount interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** + * Only available if discount_type is `usage`. Number of usage units that this discount + * is for + */ + @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -3776,12 +3776,12 @@ private constructor( fun validate(): UsageDiscountInterval = apply { if (!validated) { - discountType() - usageDiscount() - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + discountType() + endDate() + startDate() + usageDiscount() validated = true } } @@ -3795,25 +3795,44 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() - private var usageDiscount: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var usageDiscount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usageDiscountInterval: UsageDiscountInterval) = apply { - discountType = usageDiscountInterval.discountType - usageDiscount = usageDiscountInterval.usageDiscount - startDate = usageDiscountInterval.startDate - endDate = usageDiscountInterval.endDate appliesToPriceIds = usageDiscountInterval.appliesToPriceIds appliesToPriceIntervalIds = usageDiscountInterval.appliesToPriceIntervalIds + discountType = usageDiscountInterval.discountType + endDate = usageDiscountInterval.endDate + startDate = usageDiscountInterval.startDate + usageDiscount = usageDiscountInterval.usageDiscount additionalProperties = usageDiscountInterval.additionalProperties.toMutableMap() } + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** The price ids that this discount interval applies to. */ + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = + appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) + + /** The price interval ids that this discount interval applies to. */ + fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = + apply { + this.appliesToPriceIntervalIds = appliesToPriceIntervalIds + } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) @@ -3821,6 +3840,20 @@ private constructor( this.discountType = discountType } + /** The end date of the discount interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the discount interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** The start date of the discount interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the discount interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + /** * Only available if discount_type is `usage`. Number of usage units that this * discount is for @@ -3836,39 +3869,6 @@ private constructor( this.usageDiscount = usageDiscount } - /** The start date of the discount interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the discount interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the discount interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the discount interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) - - /** The price ids that this discount interval applies to. */ - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds - } - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: List) = - appliesToPriceIntervalIds(JsonField.of(appliesToPriceIntervalIds)) - - /** The price interval ids that this discount interval applies to. */ - fun appliesToPriceIntervalIds(appliesToPriceIntervalIds: JsonField>) = - apply { - this.appliesToPriceIntervalIds = appliesToPriceIntervalIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3893,12 +3893,12 @@ private constructor( fun build(): UsageDiscountInterval = UsageDiscountInterval( - discountType, - usageDiscount, - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + discountType, + endDate, + startDate, + usageDiscount, additionalProperties.toImmutable(), ) } @@ -3959,17 +3959,17 @@ private constructor( return true } - return /* spotless:off */ other is UsageDiscountInterval && discountType == other.discountType && usageDiscount == other.usageDiscount && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UsageDiscountInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && discountType == other.discountType && endDate == other.endDate && startDate == other.startDate && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, usageDiscount, startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, discountType, endDate, startDate, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UsageDiscountInterval{discountType=$discountType, usageDiscount=$usageDiscount, startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, additionalProperties=$additionalProperties}" + "UsageDiscountInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, discountType=$discountType, endDate=$endDate, startDate=$startDate, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } } @@ -3977,39 +3977,39 @@ private constructor( class FixedFeeQuantitySchedule @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun quantity(): Double = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Double = quantity.getRequired("quantity") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4018,10 +4018,10 @@ private constructor( fun validate(): FixedFeeQuantitySchedule = apply { if (!validated) { - priceId() - startDate() endDate() + priceId() quantity() + startDate() validated = true } } @@ -4035,39 +4035,39 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantitySchedule: FixedFeeQuantitySchedule) = apply { - priceId = fixedFeeQuantitySchedule.priceId - startDate = fixedFeeQuantitySchedule.startDate endDate = fixedFeeQuantitySchedule.endDate + priceId = fixedFeeQuantitySchedule.priceId quantity = fixedFeeQuantitySchedule.quantity + startDate = fixedFeeQuantitySchedule.startDate additionalProperties = fixedFeeQuantitySchedule.additionalProperties.toMutableMap() } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) - - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4089,10 +4089,10 @@ private constructor( fun build(): FixedFeeQuantitySchedule = FixedFeeQuantitySchedule( - priceId, - startDate, endDate, + priceId, quantity, + startDate, additionalProperties.toImmutable(), ) } @@ -4102,49 +4102,42 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantitySchedule && priceId == other.priceId && startDate == other.startDate && endDate == other.endDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantitySchedule && endDate == other.endDate && priceId == other.priceId && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, startDate, endDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, priceId, quantity, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantitySchedule{priceId=$priceId, startDate=$startDate, endDate=$endDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantitySchedule{endDate=$endDate, priceId=$priceId, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect class MaximumInterval - @JsonCreator - private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), + @JsonCreator + private constructor( @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("maximum_amount") @ExcludeMissing private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the maximum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the maximum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4153,6 +4146,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the maximum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4160,10 +4157,7 @@ private constructor( fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** The start date of the maximum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the maximum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this maximum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4175,12 +4169,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the maximum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. */ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** The start date of the maximum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4189,11 +4189,11 @@ private constructor( fun validate(): MaximumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() maximumAmount() + startDate() validated = true } } @@ -4207,37 +4207,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(maximumInterval: MaximumInterval) = apply { - startDate = maximumInterval.startDate - endDate = maximumInterval.endDate appliesToPriceIds = maximumInterval.appliesToPriceIds appliesToPriceIntervalIds = maximumInterval.appliesToPriceIntervalIds + endDate = maximumInterval.endDate maximumAmount = maximumInterval.maximumAmount + startDate = maximumInterval.startDate additionalProperties = maximumInterval.additionalProperties.toMutableMap() } - /** The start date of the maximum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the maximum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the maximum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the maximum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this maximum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4257,6 +4243,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the maximum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the maximum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The maximum amount to charge in a given billing period for the price intervals this * transform applies to. @@ -4271,6 +4263,14 @@ private constructor( this.maximumAmount = maximumAmount } + /** The start date of the maximum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the maximum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4292,11 +4292,11 @@ private constructor( fun build(): MaximumInterval = MaximumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, maximumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4306,17 +4306,17 @@ private constructor( return true } - return /* spotless:off */ other is MaximumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaximumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && maximumAmount == other.maximumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, maximumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, maximumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaximumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}" + "MaximumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, maximumAmount=$maximumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4403,32 +4403,25 @@ private constructor( class MinimumInterval @JsonCreator private constructor( - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") - @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), @JsonProperty("applies_to_price_ids") @ExcludeMissing private val appliesToPriceIds: JsonField> = JsonMissing.of(), @JsonProperty("applies_to_price_interval_ids") @ExcludeMissing private val appliesToPriceIntervalIds: JsonField> = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("minimum_amount") @ExcludeMissing private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The start date of the minimum interval. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - - /** The end date of the minimum interval. */ - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") @@ -4437,6 +4430,10 @@ private constructor( fun appliesToPriceIntervalIds(): List = appliesToPriceIntervalIds.getRequired("applies_to_price_interval_ids") + /** The end date of the minimum interval. */ + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4444,10 +4441,7 @@ private constructor( fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** The start date of the minimum interval. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - /** The end date of the minimum interval. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") /** The price ids that this minimum interval applies to. */ @JsonProperty("applies_to_price_ids") @@ -4459,12 +4453,18 @@ private constructor( @ExcludeMissing fun _appliesToPriceIntervalIds() = appliesToPriceIntervalIds + /** The end date of the minimum interval. */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. */ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** The start date of the minimum interval. */ + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -4473,11 +4473,11 @@ private constructor( fun validate(): MinimumInterval = apply { if (!validated) { - startDate() - endDate() appliesToPriceIds() appliesToPriceIntervalIds() + endDate() minimumAmount() + startDate() validated = true } } @@ -4491,37 +4491,23 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var appliesToPriceIntervalIds: JsonField> = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var minimumAmount: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(minimumInterval: MinimumInterval) = apply { - startDate = minimumInterval.startDate - endDate = minimumInterval.endDate appliesToPriceIds = minimumInterval.appliesToPriceIds appliesToPriceIntervalIds = minimumInterval.appliesToPriceIntervalIds + endDate = minimumInterval.endDate minimumAmount = minimumInterval.minimumAmount + startDate = minimumInterval.startDate additionalProperties = minimumInterval.additionalProperties.toMutableMap() } - /** The start date of the minimum interval. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) - - /** The start date of the minimum interval. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - /** The end date of the minimum interval. */ - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - /** The end date of the minimum interval. */ - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - /** The price ids that this minimum interval applies to. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) @@ -4541,6 +4527,12 @@ private constructor( this.appliesToPriceIntervalIds = appliesToPriceIntervalIds } + /** The end date of the minimum interval. */ + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + /** The end date of the minimum interval. */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** * The minimum amount to charge in a given billing period for the price intervals this * minimum applies to. @@ -4555,6 +4547,14 @@ private constructor( this.minimumAmount = minimumAmount } + /** The start date of the minimum interval. */ + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + + /** The start date of the minimum interval. */ + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -4576,11 +4576,11 @@ private constructor( fun build(): MinimumInterval = MinimumInterval( - startDate, - endDate, appliesToPriceIds.map { it.toImmutable() }, appliesToPriceIntervalIds.map { it.toImmutable() }, + endDate, minimumAmount, + startDate, additionalProperties.toImmutable(), ) } @@ -4590,17 +4590,17 @@ private constructor( return true } - return /* spotless:off */ other is MinimumInterval && startDate == other.startDate && endDate == other.endDate && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && minimumAmount == other.minimumAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MinimumInterval && appliesToPriceIds == other.appliesToPriceIds && appliesToPriceIntervalIds == other.appliesToPriceIntervalIds && endDate == other.endDate && minimumAmount == other.minimumAmount && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, appliesToPriceIds, appliesToPriceIntervalIds, minimumAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, appliesToPriceIntervalIds, endDate, minimumAmount, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MinimumInterval{startDate=$startDate, endDate=$endDate, appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" + "MinimumInterval{appliesToPriceIds=$appliesToPriceIds, appliesToPriceIntervalIds=$appliesToPriceIntervalIds, endDate=$endDate, minimumAmount=$minimumAmount, startDate=$startDate, additionalProperties=$additionalProperties}" } /** @@ -4612,39 +4612,56 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), - @JsonProperty("start_date") + @JsonProperty("billing_cycle_day") @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), - @JsonProperty("end_date") + private val billingCycleDay: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_end_date") @ExcludeMissing - private val endDate: JsonField = JsonMissing.of(), - @JsonProperty("price") + private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + @JsonProperty("current_billing_period_start_date") @ExcludeMissing - private val price: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_day") + private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), + @JsonProperty("end_date") @ExcludeMissing - private val billingCycleDay: JsonField = JsonMissing.of(), + private val endDate: JsonField = JsonMissing.of(), @JsonProperty("fixed_fee_quantity_transitions") @ExcludeMissing private val fixedFeeQuantityTransitions: JsonField> = JsonMissing.of(), - @JsonProperty("current_billing_period_start_date") + @JsonProperty("price") @ExcludeMissing - private val currentBillingPeriodStartDate: JsonField = JsonMissing.of(), - @JsonProperty("current_billing_period_end_date") + private val price: JsonField = JsonMissing.of(), + @JsonProperty("start_date") @ExcludeMissing - private val currentBillingPeriodEndDate: JsonField = JsonMissing.of(), + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun id(): String = id.getRequired("id") + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") + /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") + fun currentBillingPeriodEndDate(): Optional = + Optional.ofNullable( + currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") + ) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. + */ + fun currentBillingPeriodStartDate(): Optional = + Optional.ofNullable( + currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") + ) /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -4653,6 +4670,15 @@ private constructor( fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions(): Optional> = + Optional.ofNullable( + fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") + ) + /** * The Price resource represents a price that can be billed on a subscription, resulting in * a charge on an invoice in the form of an invoice line item. Prices take a quantity and @@ -4883,51 +4909,48 @@ private constructor( */ fun price(): Price = price.getRequired("price") - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(): Long = billingCycleDay.getRequired("billing_cycle_day") - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - fun fixedFeeQuantityTransitions(): Optional> = - Optional.ofNullable( - fixedFeeQuantityTransitions.getNullable("fixed_fee_quantity_transitions") - ) + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - fun currentBillingPeriodStartDate(): Optional = - Optional.ofNullable( - currentBillingPeriodStartDate.getNullable("current_billing_period_start_date") - ) + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** The day of the month that Orb bills for this price */ + @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay /** * The end of the current billing period. This is an exclusive timestamp, such that the * instant returned is exactly the end of the billing period. Set to null if this price * interval is not currently active. */ - fun currentBillingPeriodEndDate(): Optional = - Optional.ofNullable( - currentBillingPeriodEndDate.getNullable("current_billing_period_end_date") - ) - - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("current_billing_period_end_date") + @ExcludeMissing + fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate /** - * The start date of the price interval. This is the date that Orb starts billing for this - * price. + * The start date of the current billing period. This is an inclusive timestamp; the instant + * returned is exactly the beginning of the billing period. Set to null if this price + * interval is not currently active. */ - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("current_billing_period_start_date") + @ExcludeMissing + fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate /** * The end date of the price interval. This is the date that Orb stops billing for this * price. */ - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + @JsonProperty("fixed_fee_quantity_transitions") + @ExcludeMissing + fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions /** * The Price resource represents a price that can be billed on a subscription, resulting in @@ -5159,34 +5182,11 @@ private constructor( */ @JsonProperty("price") @ExcludeMissing fun _price() = price - /** The day of the month that Orb bills for this price */ - @JsonProperty("billing_cycle_day") @ExcludeMissing fun _billingCycleDay() = billingCycleDay - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - @JsonProperty("fixed_fee_quantity_transitions") - @ExcludeMissing - fun _fixedFeeQuantityTransitions() = fixedFeeQuantityTransitions - /** - * The start date of the current billing period. This is an inclusive timestamp; the instant - * returned is exactly the beginning of the billing period. Set to null if this price - * interval is not currently active. - */ - @JsonProperty("current_billing_period_start_date") - @ExcludeMissing - fun _currentBillingPeriodStartDate() = currentBillingPeriodStartDate - - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for this + * price. */ - @JsonProperty("current_billing_period_end_date") - @ExcludeMissing - fun _currentBillingPeriodEndDate() = currentBillingPeriodEndDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate @JsonAnyGetter @ExcludeMissing @@ -5197,13 +5197,13 @@ private constructor( fun validate(): PriceInterval = apply { if (!validated) { id() - startDate() - endDate() - price() billingCycleDay() - fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } - currentBillingPeriodStartDate() currentBillingPeriodEndDate() + currentBillingPeriodStartDate() + endDate() + fixedFeeQuantityTransitions().map { it.forEach { it.validate() } } + price() + startDate() validated = true } } @@ -5218,26 +5218,26 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var price: JsonField = JsonMissing.of() private var billingCycleDay: JsonField = JsonMissing.of() + private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() private var fixedFeeQuantityTransitions: JsonField> = JsonMissing.of() - private var currentBillingPeriodStartDate: JsonField = JsonMissing.of() - private var currentBillingPeriodEndDate: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceInterval: PriceInterval) = apply { id = priceInterval.id - startDate = priceInterval.startDate - endDate = priceInterval.endDate - price = priceInterval.price billingCycleDay = priceInterval.billingCycleDay - fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions - currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate + currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate + endDate = priceInterval.endDate + fixedFeeQuantityTransitions = priceInterval.fixedFeeQuantityTransitions + price = priceInterval.price + startDate = priceInterval.startDate additionalProperties = priceInterval.additionalProperties.toMutableMap() } @@ -5245,19 +5245,48 @@ private constructor( fun id(id: JsonField) = apply { this.id = id } + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: Long) = + billingCycleDay(JsonField.of(billingCycleDay)) + + /** The day of the month that Orb bills for this price */ + fun billingCycleDay(billingCycleDay: JsonField) = apply { + this.billingCycleDay = billingCycleDay + } + /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) + fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = + currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) /** - * The start date of the price interval. This is the date that Orb starts billing for - * this price. + * The end of the current billing period. This is an exclusive timestamp, such that the + * instant returned is exactly the end of the billing period. Set to null if this price + * interval is not currently active. */ - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } + fun currentBillingPeriodEndDate( + currentBillingPeriodEndDate: JsonField + ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = + currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) + + /** + * The start date of the current billing period. This is an inclusive timestamp; the + * instant returned is exactly the beginning of the billing period. Set to null if this + * price interval is not currently active. + */ + fun currentBillingPeriodStartDate( + currentBillingPeriodStartDate: JsonField + ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } /** * The end date of the price interval. This is the date that Orb stops billing for this @@ -5271,6 +5300,22 @@ private constructor( */ fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: List + ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) + + /** + * The fixed fee quantity transitions for this price interval. This is only relevant for + * fixed fees. + */ + fun fixedFeeQuantityTransitions( + fixedFeeQuantityTransitions: JsonField> + ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + /** * The Price resource represents a price that can be billed on a subscription, resulting * in a charge on an invoice in the form of an invoice line item. Prices take a quantity @@ -5731,64 +5776,19 @@ private constructor( */ fun price(price: JsonField) = apply { this.price = price } - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: Long) = - billingCycleDay(JsonField.of(billingCycleDay)) - - /** The day of the month that Orb bills for this price */ - fun billingCycleDay(billingCycleDay: JsonField) = apply { - this.billingCycleDay = billingCycleDay - } - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: List - ) = fixedFeeQuantityTransitions(JsonField.of(fixedFeeQuantityTransitions)) - - /** - * The fixed fee quantity transitions for this price interval. This is only relevant for - * fixed fees. - */ - fun fixedFeeQuantityTransitions( - fixedFeeQuantityTransitions: JsonField> - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate(currentBillingPeriodStartDate: OffsetDateTime) = - currentBillingPeriodStartDate(JsonField.of(currentBillingPeriodStartDate)) - - /** - * The start date of the current billing period. This is an inclusive timestamp; the - * instant returned is exactly the beginning of the billing period. Set to null if this - * price interval is not currently active. - */ - fun currentBillingPeriodStartDate( - currentBillingPeriodStartDate: JsonField - ) = apply { this.currentBillingPeriodStartDate = currentBillingPeriodStartDate } - /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate(currentBillingPeriodEndDate: OffsetDateTime) = - currentBillingPeriodEndDate(JsonField.of(currentBillingPeriodEndDate)) + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) /** - * The end of the current billing period. This is an exclusive timestamp, such that the - * instant returned is exactly the end of the billing period. Set to null if this price - * interval is not currently active. + * The start date of the price interval. This is the date that Orb starts billing for + * this price. */ - fun currentBillingPeriodEndDate( - currentBillingPeriodEndDate: JsonField - ) = apply { this.currentBillingPeriodEndDate = currentBillingPeriodEndDate } + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5812,13 +5812,13 @@ private constructor( fun build(): PriceInterval = PriceInterval( id, - startDate, - endDate, - price, billingCycleDay, - fixedFeeQuantityTransitions.map { it.toImmutable() }, - currentBillingPeriodStartDate, currentBillingPeriodEndDate, + currentBillingPeriodStartDate, + endDate, + fixedFeeQuantityTransitions.map { it.toImmutable() }, + price, + startDate, additionalProperties.toImmutable(), ) } @@ -5827,12 +5827,12 @@ private constructor( class FixedFeeQuantityTransition @JsonCreator private constructor( - @JsonProperty("price_id") - @ExcludeMissing - private val priceId: JsonField = JsonMissing.of(), @JsonProperty("effective_date") @ExcludeMissing private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("price_id") + @ExcludeMissing + private val priceId: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), @@ -5840,16 +5840,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun priceId(): String = priceId.getRequired("price_id") - fun effectiveDate(): OffsetDateTime = effectiveDate.getRequired("effective_date") - fun quantity(): Long = quantity.getRequired("quantity") + fun priceId(): String = priceId.getRequired("price_id") - @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + fun quantity(): Long = quantity.getRequired("quantity") @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + @JsonProperty("price_id") @ExcludeMissing fun _priceId() = priceId + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity @JsonAnyGetter @@ -5860,8 +5860,8 @@ private constructor( fun validate(): FixedFeeQuantityTransition = apply { if (!validated) { - priceId() effectiveDate() + priceId() quantity() validated = true } @@ -5876,24 +5876,20 @@ private constructor( class Builder { - private var priceId: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var priceId: JsonField = JsonMissing.of() private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedFeeQuantityTransition: FixedFeeQuantityTransition) = apply { - priceId = fixedFeeQuantityTransition.priceId effectiveDate = fixedFeeQuantityTransition.effectiveDate + priceId = fixedFeeQuantityTransition.priceId quantity = fixedFeeQuantityTransition.quantity additionalProperties = fixedFeeQuantityTransition.additionalProperties.toMutableMap() } - fun priceId(priceId: String) = priceId(JsonField.of(priceId)) - - fun priceId(priceId: JsonField) = apply { this.priceId = priceId } - fun effectiveDate(effectiveDate: OffsetDateTime) = effectiveDate(JsonField.of(effectiveDate)) @@ -5901,6 +5897,10 @@ private constructor( this.effectiveDate = effectiveDate } + fun priceId(priceId: String) = priceId(JsonField.of(priceId)) + + fun priceId(priceId: JsonField) = apply { this.priceId = priceId } + fun quantity(quantity: Long) = quantity(JsonField.of(quantity)) fun quantity(quantity: JsonField) = apply { this.quantity = quantity } @@ -5929,8 +5929,8 @@ private constructor( fun build(): FixedFeeQuantityTransition = FixedFeeQuantityTransition( - priceId, effectiveDate, + priceId, quantity, additionalProperties.toImmutable(), ) @@ -5941,17 +5941,17 @@ private constructor( return true } - return /* spotless:off */ other is FixedFeeQuantityTransition && priceId == other.priceId && effectiveDate == other.effectiveDate && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is FixedFeeQuantityTransition && effectiveDate == other.effectiveDate && priceId == other.priceId && quantity == other.quantity && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(priceId, effectiveDate, quantity, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(effectiveDate, priceId, quantity, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "FixedFeeQuantityTransition{priceId=$priceId, effectiveDate=$effectiveDate, quantity=$quantity, additionalProperties=$additionalProperties}" + "FixedFeeQuantityTransition{effectiveDate=$effectiveDate, priceId=$priceId, quantity=$quantity, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5959,17 +5959,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceInterval && id == other.id && startDate == other.startDate && endDate == other.endDate && price == other.price && billingCycleDay == other.billingCycleDay && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceInterval && id == other.id && billingCycleDay == other.billingCycleDay && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && endDate == other.endDate && fixedFeeQuantityTransitions == other.fixedFeeQuantityTransitions && price == other.price && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, startDate, endDate, price, billingCycleDay, fixedFeeQuantityTransitions, currentBillingPeriodStartDate, currentBillingPeriodEndDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billingCycleDay, currentBillingPeriodEndDate, currentBillingPeriodStartDate, endDate, fixedFeeQuantityTransitions, price, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceInterval{id=$id, startDate=$startDate, endDate=$endDate, price=$price, billingCycleDay=$billingCycleDay, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, additionalProperties=$additionalProperties}" + "PriceInterval{id=$id, billingCycleDay=$billingCycleDay, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, endDate=$endDate, fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions, price=$price, startDate=$startDate, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -5979,29 +5979,29 @@ private constructor( @JsonProperty("coupon_id") @ExcludeMissing private val couponId: JsonField = JsonMissing.of(), - @JsonProperty("start_date") - @ExcludeMissing - private val startDate: JsonField = JsonMissing.of(), @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun couponId(): String = couponId.getRequired("coupon_id") - fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId + fun startDate(): OffsetDateTime = startDate.getRequired("start_date") - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("coupon_id") @ExcludeMissing fun _couponId() = couponId @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -6011,8 +6011,8 @@ private constructor( fun validate(): RedeemedCoupon = apply { if (!validated) { couponId() - startDate() endDate() + startDate() validated = true } } @@ -6027,15 +6027,15 @@ private constructor( class Builder { private var couponId: JsonField = JsonMissing.of() - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(redeemedCoupon: RedeemedCoupon) = apply { couponId = redeemedCoupon.couponId - startDate = redeemedCoupon.startDate endDate = redeemedCoupon.endDate + startDate = redeemedCoupon.startDate additionalProperties = redeemedCoupon.additionalProperties.toMutableMap() } @@ -6043,16 +6043,16 @@ private constructor( fun couponId(couponId: JsonField) = apply { this.couponId = couponId } + fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: OffsetDateTime) = startDate(JsonField.of(startDate)) fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: OffsetDateTime) = endDate(JsonField.of(endDate)) - - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -6075,8 +6075,8 @@ private constructor( fun build(): RedeemedCoupon = RedeemedCoupon( couponId, - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -6086,17 +6086,17 @@ private constructor( return true } - return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RedeemedCoupon && couponId == other.couponId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(couponId, startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(couponId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RedeemedCoupon{couponId=$couponId, startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } class Status @@ -6258,15 +6258,15 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateTrialResponse && metadata == other.metadata && id == other.id && customer == other.customer && plan == other.plan && startDate == other.startDate && endDate == other.endDate && createdAt == other.createdAt && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && status == other.status && trialInfo == other.trialInfo && activePlanPhaseOrder == other.activePlanPhaseOrder && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && defaultInvoiceMemo == other.defaultInvoiceMemo && autoCollection == other.autoCollection && netTerms == other.netTerms && redeemedCoupon == other.redeemedCoupon && billingCycleDay == other.billingCycleDay && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && invoicingThreshold == other.invoicingThreshold && priceIntervals == other.priceIntervals && adjustmentIntervals == other.adjustmentIntervals && discountIntervals == other.discountIntervals && minimumIntervals == other.minimumIntervals && maximumIntervals == other.maximumIntervals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateTrialResponse && id == other.id && activePlanPhaseOrder == other.activePlanPhaseOrder && adjustmentIntervals == other.adjustmentIntervals && autoCollection == other.autoCollection && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && billingCycleDay == other.billingCycleDay && createdAt == other.createdAt && currentBillingPeriodEndDate == other.currentBillingPeriodEndDate && currentBillingPeriodStartDate == other.currentBillingPeriodStartDate && customer == other.customer && defaultInvoiceMemo == other.defaultInvoiceMemo && discountIntervals == other.discountIntervals && endDate == other.endDate && fixedFeeQuantitySchedule == other.fixedFeeQuantitySchedule && invoicingThreshold == other.invoicingThreshold && maximumIntervals == other.maximumIntervals && metadata == other.metadata && minimumIntervals == other.minimumIntervals && netTerms == other.netTerms && plan == other.plan && priceIntervals == other.priceIntervals && redeemedCoupon == other.redeemedCoupon && startDate == other.startDate && status == other.status && trialInfo == other.trialInfo && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(metadata, id, customer, plan, startDate, endDate, createdAt, currentBillingPeriodStartDate, currentBillingPeriodEndDate, status, trialInfo, activePlanPhaseOrder, fixedFeeQuantitySchedule, defaultInvoiceMemo, autoCollection, netTerms, redeemedCoupon, billingCycleDay, billingCycleAnchorConfiguration, invoicingThreshold, priceIntervals, adjustmentIntervals, discountIntervals, minimumIntervals, maximumIntervals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, activePlanPhaseOrder, adjustmentIntervals, autoCollection, billingCycleAnchorConfiguration, billingCycleDay, createdAt, currentBillingPeriodEndDate, currentBillingPeriodStartDate, customer, defaultInvoiceMemo, discountIntervals, endDate, fixedFeeQuantitySchedule, invoicingThreshold, maximumIntervals, metadata, minimumIntervals, netTerms, plan, priceIntervals, redeemedCoupon, startDate, status, trialInfo, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUpdateTrialResponse{metadata=$metadata, id=$id, customer=$customer, plan=$plan, startDate=$startDate, endDate=$endDate, createdAt=$createdAt, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, status=$status, trialInfo=$trialInfo, activePlanPhaseOrder=$activePlanPhaseOrder, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, defaultInvoiceMemo=$defaultInvoiceMemo, autoCollection=$autoCollection, netTerms=$netTerms, redeemedCoupon=$redeemedCoupon, billingCycleDay=$billingCycleDay, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, invoicingThreshold=$invoicingThreshold, priceIntervals=$priceIntervals, adjustmentIntervals=$adjustmentIntervals, discountIntervals=$discountIntervals, minimumIntervals=$minimumIntervals, maximumIntervals=$maximumIntervals, additionalProperties=$additionalProperties}" + "SubscriptionUpdateTrialResponse{id=$id, activePlanPhaseOrder=$activePlanPhaseOrder, adjustmentIntervals=$adjustmentIntervals, autoCollection=$autoCollection, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, billingCycleDay=$billingCycleDay, createdAt=$createdAt, currentBillingPeriodEndDate=$currentBillingPeriodEndDate, currentBillingPeriodStartDate=$currentBillingPeriodStartDate, customer=$customer, defaultInvoiceMemo=$defaultInvoiceMemo, discountIntervals=$discountIntervals, endDate=$endDate, fixedFeeQuantitySchedule=$fixedFeeQuantitySchedule, invoicingThreshold=$invoicingThreshold, maximumIntervals=$maximumIntervals, metadata=$metadata, minimumIntervals=$minimumIntervals, netTerms=$netTerms, plan=$plan, priceIntervals=$priceIntervals, redeemedCoupon=$redeemedCoupon, startDate=$startDate, status=$status, trialInfo=$trialInfo, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt index 18da122a..cb06cf04 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt @@ -240,12 +240,12 @@ private constructor( class Data @JsonCreator private constructor( - @JsonProperty("usage") - @ExcludeMissing - private val usage: JsonField> = JsonMissing.of(), @JsonProperty("billable_metric") @ExcludeMissing private val billableMetric: JsonField = JsonMissing.of(), + @JsonProperty("usage") + @ExcludeMissing + private val usage: JsonField> = JsonMissing.of(), @JsonProperty("view_mode") @ExcludeMissing private val viewMode: JsonField = JsonMissing.of(), @@ -253,16 +253,16 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun usage(): List = usage.getRequired("usage") - fun billableMetric(): BillableMetric = billableMetric.getRequired("billable_metric") - fun viewMode(): ViewMode = viewMode.getRequired("view_mode") + fun usage(): List = usage.getRequired("usage") - @JsonProperty("usage") @ExcludeMissing fun _usage() = usage + fun viewMode(): ViewMode = viewMode.getRequired("view_mode") @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + @JsonProperty("usage") @ExcludeMissing fun _usage() = usage + @JsonProperty("view_mode") @ExcludeMissing fun _viewMode() = viewMode @JsonAnyGetter @@ -273,8 +273,8 @@ private constructor( fun validate(): Data = apply { if (!validated) { - usage().forEach { it.validate() } billableMetric().validate() + usage().forEach { it.validate() } viewMode() validated = true } @@ -289,23 +289,19 @@ private constructor( class Builder { - private var usage: JsonField> = JsonMissing.of() private var billableMetric: JsonField = JsonMissing.of() + private var usage: JsonField> = JsonMissing.of() private var viewMode: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { - usage = data.usage billableMetric = data.billableMetric + usage = data.usage viewMode = data.viewMode additionalProperties = data.additionalProperties.toMutableMap() } - fun usage(usage: List) = usage(JsonField.of(usage)) - - fun usage(usage: JsonField>) = apply { this.usage = usage } - fun billableMetric(billableMetric: BillableMetric) = billableMetric(JsonField.of(billableMetric)) @@ -313,6 +309,10 @@ private constructor( this.billableMetric = billableMetric } + fun usage(usage: List) = usage(JsonField.of(usage)) + + fun usage(usage: JsonField>) = apply { this.usage = usage } + fun viewMode(viewMode: ViewMode) = viewMode(JsonField.of(viewMode)) fun viewMode(viewMode: JsonField) = apply { this.viewMode = viewMode } @@ -341,8 +341,8 @@ private constructor( fun build(): Data = Data( - usage.map { it.toImmutable() }, billableMetric, + usage.map { it.toImmutable() }, viewMode, additionalProperties.toImmutable(), ) @@ -467,30 +467,30 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_start") - @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), @JsonProperty("timeframe_end") @ExcludeMissing private val timeframeEnd: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_start") + @ExcludeMissing + private val timeframeStart: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun quantity(): Double = quantity.getRequired("quantity") - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -500,8 +500,8 @@ private constructor( fun validate(): Usage = apply { if (!validated) { quantity() - timeframeStart() timeframeEnd() + timeframeStart() validated = true } } @@ -516,15 +516,15 @@ private constructor( class Builder { private var quantity: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usage: Usage) = apply { quantity = usage.quantity - timeframeStart = usage.timeframeStart timeframeEnd = usage.timeframeEnd + timeframeStart = usage.timeframeStart additionalProperties = usage.additionalProperties.toMutableMap() } @@ -532,13 +532,6 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) - - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } - fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) @@ -546,6 +539,13 @@ private constructor( this.timeframeEnd = timeframeEnd } + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) + + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -571,8 +571,8 @@ private constructor( fun build(): Usage = Usage( quantity, - timeframeStart, timeframeEnd, + timeframeStart, additionalProperties.toImmutable(), ) } @@ -582,17 +582,17 @@ private constructor( return true } - return /* spotless:off */ other is Usage && quantity == other.quantity && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Usage && quantity == other.quantity && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(quantity, timeframeStart, timeframeEnd, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(quantity, timeframeEnd, timeframeStart, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Usage{quantity=$quantity, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, additionalProperties=$additionalProperties}" + "Usage{quantity=$quantity, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" } class ViewMode @@ -657,17 +657,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && usage == other.usage && billableMetric == other.billableMetric && viewMode == other.viewMode && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && billableMetric == other.billableMetric && usage == other.usage && viewMode == other.viewMode && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(usage, billableMetric, viewMode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(billableMetric, usage, viewMode, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{usage=$usage, billableMetric=$billableMetric, viewMode=$viewMode, additionalProperties=$additionalProperties}" + "Data{billableMetric=$billableMetric, usage=$usage, viewMode=$viewMode, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -789,15 +789,15 @@ private constructor( class Data @JsonCreator private constructor( - @JsonProperty("usage") - @ExcludeMissing - private val usage: JsonField> = JsonMissing.of(), @JsonProperty("billable_metric") @ExcludeMissing private val billableMetric: JsonField = JsonMissing.of(), @JsonProperty("metric_group") @ExcludeMissing private val metricGroup: JsonField = JsonMissing.of(), + @JsonProperty("usage") + @ExcludeMissing + private val usage: JsonField> = JsonMissing.of(), @JsonProperty("view_mode") @ExcludeMissing private val viewMode: JsonField = JsonMissing.of(), @@ -805,20 +805,20 @@ private constructor( private val additionalProperties: Map = immutableEmptyMap(), ) { - fun usage(): List = usage.getRequired("usage") - fun billableMetric(): BillableMetric = billableMetric.getRequired("billable_metric") fun metricGroup(): MetricGroup = metricGroup.getRequired("metric_group") - fun viewMode(): ViewMode = viewMode.getRequired("view_mode") + fun usage(): List = usage.getRequired("usage") - @JsonProperty("usage") @ExcludeMissing fun _usage() = usage + fun viewMode(): ViewMode = viewMode.getRequired("view_mode") @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric @JsonProperty("metric_group") @ExcludeMissing fun _metricGroup() = metricGroup + @JsonProperty("usage") @ExcludeMissing fun _usage() = usage + @JsonProperty("view_mode") @ExcludeMissing fun _viewMode() = viewMode @JsonAnyGetter @@ -829,9 +829,9 @@ private constructor( fun validate(): Data = apply { if (!validated) { - usage().forEach { it.validate() } billableMetric().validate() metricGroup().validate() + usage().forEach { it.validate() } viewMode() validated = true } @@ -846,25 +846,21 @@ private constructor( class Builder { - private var usage: JsonField> = JsonMissing.of() private var billableMetric: JsonField = JsonMissing.of() private var metricGroup: JsonField = JsonMissing.of() + private var usage: JsonField> = JsonMissing.of() private var viewMode: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { - usage = data.usage billableMetric = data.billableMetric metricGroup = data.metricGroup + usage = data.usage viewMode = data.viewMode additionalProperties = data.additionalProperties.toMutableMap() } - fun usage(usage: List) = usage(JsonField.of(usage)) - - fun usage(usage: JsonField>) = apply { this.usage = usage } - fun billableMetric(billableMetric: BillableMetric) = billableMetric(JsonField.of(billableMetric)) @@ -878,6 +874,10 @@ private constructor( this.metricGroup = metricGroup } + fun usage(usage: List) = usage(JsonField.of(usage)) + + fun usage(usage: JsonField>) = apply { this.usage = usage } + fun viewMode(viewMode: ViewMode) = viewMode(JsonField.of(viewMode)) fun viewMode(viewMode: JsonField) = apply { this.viewMode = viewMode } @@ -906,9 +906,9 @@ private constructor( fun build(): Data = Data( - usage.map { it.toImmutable() }, billableMetric, metricGroup, + usage.map { it.toImmutable() }, viewMode, additionalProperties.toImmutable(), ) @@ -1150,30 +1150,30 @@ private constructor( @JsonProperty("quantity") @ExcludeMissing private val quantity: JsonField = JsonMissing.of(), - @JsonProperty("timeframe_start") - @ExcludeMissing - private val timeframeStart: JsonField = JsonMissing.of(), @JsonProperty("timeframe_end") @ExcludeMissing private val timeframeEnd: JsonField = JsonMissing.of(), + @JsonProperty("timeframe_start") + @ExcludeMissing + private val timeframeStart: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { fun quantity(): Double = quantity.getRequired("quantity") - fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") - fun timeframeEnd(): OffsetDateTime = timeframeEnd.getRequired("timeframe_end") + fun timeframeStart(): OffsetDateTime = timeframeStart.getRequired("timeframe_start") + @JsonProperty("quantity") @ExcludeMissing fun _quantity() = quantity + @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd + @JsonProperty("timeframe_start") @ExcludeMissing fun _timeframeStart() = timeframeStart - @JsonProperty("timeframe_end") @ExcludeMissing fun _timeframeEnd() = timeframeEnd - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties @@ -1183,8 +1183,8 @@ private constructor( fun validate(): Usage = apply { if (!validated) { quantity() - timeframeStart() timeframeEnd() + timeframeStart() validated = true } } @@ -1199,15 +1199,15 @@ private constructor( class Builder { private var quantity: JsonField = JsonMissing.of() - private var timeframeStart: JsonField = JsonMissing.of() private var timeframeEnd: JsonField = JsonMissing.of() + private var timeframeStart: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(usage: Usage) = apply { quantity = usage.quantity - timeframeStart = usage.timeframeStart timeframeEnd = usage.timeframeEnd + timeframeStart = usage.timeframeStart additionalProperties = usage.additionalProperties.toMutableMap() } @@ -1215,13 +1215,6 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } - fun timeframeStart(timeframeStart: OffsetDateTime) = - timeframeStart(JsonField.of(timeframeStart)) - - fun timeframeStart(timeframeStart: JsonField) = apply { - this.timeframeStart = timeframeStart - } - fun timeframeEnd(timeframeEnd: OffsetDateTime) = timeframeEnd(JsonField.of(timeframeEnd)) @@ -1229,6 +1222,13 @@ private constructor( this.timeframeEnd = timeframeEnd } + fun timeframeStart(timeframeStart: OffsetDateTime) = + timeframeStart(JsonField.of(timeframeStart)) + + fun timeframeStart(timeframeStart: JsonField) = apply { + this.timeframeStart = timeframeStart + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1254,8 +1254,8 @@ private constructor( fun build(): Usage = Usage( quantity, - timeframeStart, timeframeEnd, + timeframeStart, additionalProperties.toImmutable(), ) } @@ -1265,17 +1265,17 @@ private constructor( return true } - return /* spotless:off */ other is Usage && quantity == other.quantity && timeframeStart == other.timeframeStart && timeframeEnd == other.timeframeEnd && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Usage && quantity == other.quantity && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(quantity, timeframeStart, timeframeEnd, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(quantity, timeframeEnd, timeframeStart, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Usage{quantity=$quantity, timeframeStart=$timeframeStart, timeframeEnd=$timeframeEnd, additionalProperties=$additionalProperties}" + "Usage{quantity=$quantity, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" } class ViewMode @@ -1340,17 +1340,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && usage == other.usage && billableMetric == other.billableMetric && metricGroup == other.metricGroup && viewMode == other.viewMode && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && billableMetric == other.billableMetric && metricGroup == other.metricGroup && usage == other.usage && viewMode == other.viewMode && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(usage, billableMetric, metricGroup, viewMode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(billableMetric, metricGroup, usage, viewMode, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{usage=$usage, billableMetric=$billableMetric, metricGroup=$metricGroup, viewMode=$viewMode, additionalProperties=$additionalProperties}" + "Data{billableMetric=$billableMetric, metricGroup=$metricGroup, usage=$usage, viewMode=$viewMode, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt index 76045f97..b3d2a3cd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt @@ -22,12 +22,12 @@ import java.util.Optional class TrialDiscount @JsonCreator private constructor( - @JsonProperty("discount_type") - @ExcludeMissing - private val discountType: 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(), @@ -40,14 +40,14 @@ private constructor( @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - fun discountType(): DiscountType = discountType.getRequired("discount_type") - /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a * subset of prices. */ 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 `trial` */ @@ -58,8 +58,6 @@ private constructor( fun trialPercentageDiscount(): Optional = Optional.ofNullable(trialPercentageDiscount.getNullable("trial_percentage_discount")) - @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType - /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a * subset of prices. @@ -68,6 +66,8 @@ private constructor( @ExcludeMissing fun _appliesToPriceIds() = appliesToPriceIds + @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType + @JsonProperty("reason") @ExcludeMissing fun _reason() = reason /** Only available if discount_type is `trial` */ @@ -88,8 +88,8 @@ private constructor( fun validate(): TrialDiscount = apply { if (!validated) { - discountType() appliesToPriceIds() + discountType() reason() trialAmountDiscount() trialPercentageDiscount() @@ -106,8 +106,8 @@ private constructor( class Builder { - private var discountType: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var discountType: JsonField = JsonMissing.of() private var reason: JsonField = JsonMissing.of() private var trialAmountDiscount: JsonField = JsonMissing.of() private var trialPercentageDiscount: JsonField = JsonMissing.of() @@ -115,20 +115,14 @@ private constructor( @JvmSynthetic internal fun from(trialDiscount: TrialDiscount) = apply { - discountType = trialDiscount.discountType appliesToPriceIds = trialDiscount.appliesToPriceIds + discountType = trialDiscount.discountType reason = trialDiscount.reason trialAmountDiscount = trialDiscount.trialAmountDiscount trialPercentageDiscount = trialDiscount.trialPercentageDiscount additionalProperties = trialDiscount.additionalProperties.toMutableMap() } - fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) - - fun discountType(discountType: JsonField) = apply { - this.discountType = discountType - } - /** * List of price_ids that this discount applies to. For plan/plan phase discounts, this can * be a subset of prices. @@ -144,6 +138,12 @@ private constructor( this.appliesToPriceIds = appliesToPriceIds } + fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType)) + + fun discountType(discountType: JsonField) = apply { + this.discountType = discountType + } + fun reason(reason: String) = reason(JsonField.of(reason)) fun reason(reason: JsonField) = apply { this.reason = reason } @@ -187,8 +187,8 @@ private constructor( fun build(): TrialDiscount = TrialDiscount( - discountType, appliesToPriceIds.map { it.toImmutable() }, + discountType, reason, trialAmountDiscount, trialPercentageDiscount, @@ -252,15 +252,15 @@ private constructor( return true } - return /* spotless:off */ other is TrialDiscount && discountType == other.discountType && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && trialAmountDiscount == other.trialAmountDiscount && trialPercentageDiscount == other.trialPercentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TrialDiscount && appliesToPriceIds == other.appliesToPriceIds && discountType == other.discountType && reason == other.reason && trialAmountDiscount == other.trialAmountDiscount && trialPercentageDiscount == other.trialPercentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(discountType, appliesToPriceIds, reason, trialAmountDiscount, trialPercentageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, discountType, reason, trialAmountDiscount, trialPercentageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TrialDiscount{discountType=$discountType, appliesToPriceIds=$appliesToPriceIds, reason=$reason, trialAmountDiscount=$trialAmountDiscount, trialPercentageDiscount=$trialPercentageDiscount, additionalProperties=$additionalProperties}" + "TrialDiscount{appliesToPriceIds=$appliesToPriceIds, discountType=$discountType, reason=$reason, trialAmountDiscount=$trialAmountDiscount, trialPercentageDiscount=$trialPercentageDiscount, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt index 81cca665..c07c0a7b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt @@ -455,7 +455,7 @@ class InvoiceFetchUpcomingResponseTest { ) ) assertThat(invoiceFetchUpcomingResponse.dueDate()) - .contains(OffsetDateTime.parse("2022-05-30T07:00:00+00:00")) + .isEqualTo(OffsetDateTime.parse("2022-05-30T07:00:00+00:00")) assertThat(invoiceFetchUpcomingResponse.eligibleToIssueAt()) .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(invoiceFetchUpcomingResponse.hostedInvoiceUrl()).contains("hosted_invoice_url") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt index a15c40ba..978faec7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt @@ -423,7 +423,7 @@ class InvoiceTest { .build() ) ) - assertThat(invoice.dueDate()).contains(OffsetDateTime.parse("2022-05-30T07:00:00+00:00")) + assertThat(invoice.dueDate()).isEqualTo(OffsetDateTime.parse("2022-05-30T07:00:00+00:00")) assertThat(invoice.eligibleToIssueAt()) .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(invoice.hostedInvoiceUrl()).contains("hosted_invoice_url")